Is __default_alloc_template thread safe on Solaris?

Dhammika Pathirana dammikap@sltnet.lk
Sat Jan 10 01:57:00 GMT 2004


Loren James Rittle wrote:
>>I have extensively used libstdc++ on multithreaded apps on linux 
>>platform, however STLs seem to have notorious behaviour on Solaris 
>>platform. [...] g++ verion on Solaris is 2.95.3 while 
> 
> 
> IMHO, it is *very* hard to configure and use threads in STL properly
> with g++ 2.95.X (and anything before 3.0) on a random port.  Your
> report confirms that fact.  Upgrade your Solaris box to (at least) g++
> 3.2, where the compiler reports "Thread model: posix".
> 
> Regards,
> Loren
> 
> 

However defining _PTHREADS as a compiler flag seems to solve my problem.
Would you recommend doing so? It's not actually possible to move into a 
more recent g++ release due to some other constraints. I see four options,
     1. Remove threading (this is not actually possible for me)
     2. Move STL related stuff to a single thread
     3. Define _PTHREADS as a compiler flag
     4. Move to a thread safe STL implementation

What would you recommed?

tnx

dhammika




More information about the Libstdc++ mailing list