C++ new operator thread safety in linux and gcc 4 -
I will soon start working on parallel versions of an Aries refine algorithm using shared memory.
A university professor said that we must be very careful about thread protection because neither the compiler nor the thread of the style is known.
I searched this question and the answer was dependent on the compiler (try something to some extent thread-aware) and platform (if the system is called by the compiler Whether it is thread-protected or not).
So, in Linux, the GCC 4 compiler produces a thread-safe code for the new operator?
If not, what is the best way to overcome this problem ? Perhaps every call is locked in the new operator?
You will have to look very hard to find a platform supports thread but there is no thread safe in it < Code> New is not, in fact, the thread protection of new (and malloc ) is very slow.
If you want a thread secured STL On the other hand, you can consider that the thread knows the container (although the thread is not safe for all those operations).
Comments
Post a Comment