]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/commands.cxx
Merge branch 'master' of git://gitorious.org/fg/simgear into fredb/winbuild
[simgear.git] / simgear / structure / commands.cxx
index 49a9c63cde0d605c94d73f537a7cc5b95f515126..b2391e3ba7f1cff7986f8eacf5364e985739ee56 100644 (file)
@@ -4,13 +4,20 @@
 //
 // $Id$
 
+#ifdef HAVE_CONFIG_H
+#  include <simgear_config.h>
+#endif
+
 #include <memory>
 #include <simgear/props/props_io.hxx>
-#include <simgear/threads/SGThread.hxx>
-#include <simgear/threads/SGGuard.hxx>
+
+#include <OpenThreads/Mutex>
+#include <OpenThreads/ScopedLock>
 
 #include "commands.hxx"
 
+#include <simgear/math/SGMath.hxx>
+
 
 \f
 ////////////////////////////////////////////////////////////////////////
@@ -28,6 +35,8 @@ SGCommandMgr::~SGCommandMgr ()
   // no-op
 }
 
+OpenThreads::Mutex SGCommandMgr::_instanceMutex;
+
 SGCommandMgr*
 SGCommandMgr::instance()
 {
@@ -35,8 +44,7 @@ SGCommandMgr::instance()
   if (mgr.get())
     return mgr.get();
 
-  static SGMutex lock;
-  SGGuard<SGMutex> guard(lock);
+  OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_instanceMutex);
   if (mgr.get())
     return mgr.get();