Commit 58c86fef by Marcus Winter

mtapi_cpp: used double-checked locking pattern in Node::GetInstance

parent 049b3b00
......@@ -198,6 +198,7 @@ bool Node::IsInitialized() {
Node & Node::GetInstance() {
#if MTAPI_CPP_AUTOMATIC_INITIALIZE
if (!IsInitialized()) {
init_mutex.Lock();
if (!IsInitialized()) {
Node::Initialize(
......@@ -205,6 +206,7 @@ Node & Node::GetInstance() {
atexit(Node::Finalize);
}
init_mutex.Unlock();
}
return *node_instance;
#else
if (IsInitialized()) {
......
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 sign in to comment