Subject: Re: [boost] a new library Global Object Manager submission interest check
From: Glen Fernandes (glen.fernandes_at_[hidden])
Date: 2014-06-07 19:58:14
On Sat, Jun 7, 2014 at 3:28 PM, George Georgiev wrote:
> I have code that deals with problems related to initialization of global
> objects (singletons).
> 1. Multi-threading - problems occurring in some singleton patterns based on
> the fact that local for a function or method static variables are not
> initialized in a thread safe manner
Did you mean specifically for C++03 / non-C++11 compilers? With C++11,
initialization of function-local statics is guaranteed to be
For those compilers that do not implement that C++11 requirement (like
VC12), how does your solution for thread-safe singleton initialization
compare (performance-wise) to, say,
or other alternatives?
In any case, I'm curious to see your solution. Is it on GitHub?
[ Side note: Instead of boost::shared_ptr<T>(new T(...)) always prefer
boost::make_shared<T>(...). For better performance (one allocation
instead of two) and exception-safety. Granted, this is a test snippet,
but I also noticed it in Compil. :-) ]
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk