
14 Dec
2010
14 Dec
'10
11:58 a.m.
Vokuba wrote:
Just a short question: Do you think I need a mutex for the 'static boost::barrier(nThreads)' lines in the sample code snippet below ? I always thought that static data in a function has to be protected by a mutex.
For some years gcc has been protecting function-scope statics with a mutex by default. You can change this with -fno-threadsafe-statics. I'm unsure what other compilers do and what the standards require (though I did know at one time!). Regards, Phil.