Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2008-01-18 03:42:17

Phil Endecott wrote:
>> |- boost::singleton| : can be used to create Singletons with
>> synchronized initialization.
> I've just become aware that g++ already provides synchronised
> initialisation of function-scope statics, unless you specify
> -fno-threadsafe-statics, and that if N2444 is accepted this will be the
> required behaviour in C++0x. With this functionality, there is no need
> for the proposed boost::singleton class since Meyer's singleton suffices:

I'm aware of the ABI improvements. I'm also aware that GCC4 has

     #pragma GCC visibility ...

(or so) which lets us turn off symbol merging (and is nonstandard).
Pretty cool stuff (and makes SubsystemTag unnecessary).

Meyers' Singleton does not suffice in all cases. And C++0x is far future
given that many compilers that are in use today don't even speak C++98.

> Tobias, since I wrote my review I've seen a few others also suggesting
> that you should decouple the thread-safety features (e.g. the
> synchronous access in your mutex_singleton) from the singleton itself.
> I would be interested to know whether you would consider doing this in
> a revision of your submission, or whether you want to stick to your
> existing implementation.

I'm afraid that in the foreseeable future there won't be enough spare
time in one piece for me to get it done.


Boost list run by bdawes at, gregod at, cpdaniel at, john at