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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


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: pgpqCElrpgG5T.pgp
Description: PGP signature


[Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

Add to Google