Boost logo

Boost :

Subject: Re: [boost] [thread] thread-safe static local
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2009-03-03 18:11:48


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.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk