This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++ 4.7 with g++0x threads & profiling


Folkert van Heusden writes:

Hi,

I have a C++ application using the new std::thread functionality.
At random I see all kinds of crashes, mostly in std::string but also
in std::map and friends.
I have profiling (-pg) enabled. It seems that if I disable profiling,
also the random errors (SIGSEGV) disappear.
Are there any known issues with profiling, c++0x and gcc version 4.7
with this? (tried g++ 4.6 as well)

Neither std::map, nor std::string, is thread-safe, AFAIK. Individual instances of these, and pretty much all other classes, must be appropriately protected and accessed in a safe thread context, using std::mutex or a reasonable facsimile. You have not mentioned whether or not you may be potentially accessing same instances of std::string or std::map from concurrent threads, and whether you're employing std::mutex to do so.


Profiling modifies runtime behavior, by its inherent nature. If there's ill- formed, non-deterministic behavior, such as thread-unsafe access; it would not be unusual for this to manifest itself with more or less frequency, either in presence or in the absence of, runtime profiling.

Attachment: pgp00000.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]