Commit 1727a98f authored by Sebastian Eibl's avatar Sebastian Eibl

improved performance of Singleton

parent 75d75fe8
Pipeline #15487 passed with stages
in 372 minutes and 24 seconds
......@@ -86,7 +86,8 @@ public:
//@{
static const shared_ptr<T>& instance()
{
std::lock_guard<std::mutex> lock( instanceMutex_ );
// this implementation is thread safe
// https://stackoverflow.com/questions/1661529/is-meyers-implementation-of-the-singleton-pattern-thread-safe
static shared_ptr<T> object( new T() );
isInstantiated_ = true;
return object;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment