
3 Mar
2009
3 Mar
'09
11:11 p.m.
Othman, Ossama wrote:
As you may know, gcc creates local statics that are thread safe by default.
Is there a way to reliably determine if the gcc's thread-safe local statics are enabled?
No, last time I looked there didn't seem to be anything. IIRC there's also no way to enable/disable it for individual variables using attributes.
If not, multithreaded library code that relies on that feature, for example, should hide static locals inside an out-of-line function/method in the odd event users of the library disable gcc's thread safe local statics for their own code through the '-fno-threadsafe-statics' command line option.
Yes, you need to do something like this if you can't require users to use the default setting. Phil.