From: Michael Marcin (mmarcin_at_[hidden])
Date: 2008-01-23 17:31:57
John Torjo wrote:
> Hi all,
> Today starts the formal Fast-Track review of the Boost.Utility/Singleton
> library. This is a very useful utility, so I'm expecting lots of reviews ;)
Singleton is a useful pattern and a library that makes it easier to
create singletons that work properly under all circumstances is also useful.
I am using this library slightly modified to fix compiler errors and
warnings from the Vault in production code.
I have some performance concerns about on demand initialization. In
general I initialize and destroy my singletons deterministically early
in main and skip the initialized check for every access.
Some people have mentioned Meyer's singleton as an option to skip the
initialized check but doesn't the compiler generally just insert that
same logic for you for function local statics?
The thread safety granularity is wrong. I need to be able to create
singletons that I know will only be used from one thread of a
multi-threaded program without the overhead of synchronization.
The ability to explicitly destroy all the singletons is crucial to my
environment where destructors for objects with static duration are not
called during program shutdown. The proposed Singleton library provides
an easy solution for this requirement which works well for me.
I see some overlap between Boost.Pool and the proposed Boost.Singleton
and if a Singleton library gets accepted into boost I'd like to see Pool
I vote to not accept this library at this time because of the thread
safety granularity issues.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk