[openrtm-commit:00752] r2341 - trunk/OpenRTM-aist/src/lib/coil/common
openrtm @ openrtm.org
openrtm @ openrtm.org
2012年 3月 8日 (木) 23:20:47 JST
Author: kurihara
Date: 2012-03-08 23:20:47 +0900 (Thu, 08 Mar 2012)
New Revision: 2341
Modified:
trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.cpp
trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.h
Log:
The problem of ClockManager on Windows has been corrected. refs #2372
Modified: trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.cpp 2012-03-08 14:13:17 UTC (rev 2340)
+++ trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.cpp 2012-03-08 14:20:47 UTC (rev 2341)
@@ -115,4 +115,20 @@
return m_systemClock;
}
+#ifdef WIN32
+ ClockManager* ClockManager::clockmgr = NULL;
+ coil::Mutex ClockManager::clockmgr_mutex;
+ ClockManager& ClockManager::instance()
+ {
+ if(!clockmgr)
+ {
+ coil::Guard<coil::Mutex> guard(clockmgr_mutex);
+ if (!clockmgr)
+ {
+ clockmgr = new ClockManager();
+ }
+ }
+ return *clockmgr;
+ }
+#endif
}; // namespace coil
Modified: trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.h 2012-03-08 14:13:17 UTC (rev 2340)
+++ trunk/OpenRTM-aist/src/lib/coil/common/ClockManager.h 2012-03-08 14:20:47 UTC (rev 2341)
@@ -23,6 +23,7 @@
#include <coil/Singleton.h>
#include <coil/TimeValue.h>
#include <coil/Mutex.h>
+#include <coil/Guard.h>
namespace coil
{
@@ -172,11 +173,20 @@
* @endif
*/
class ClockManager
+#ifndef WIN32
: public coil::Singleton<ClockManager>
+#endif
{
public:
IClock& getClock(std::string clocktype);
+#ifdef WIN32
+ static ClockManager& instance();
+ static ClockManager* clockmgr;
+ static coil::Mutex clockmgr_mutex;
private:
+ ClockManager() {};
+#endif
+ private:
SystemClock m_systemClock;
LogicalClock m_logicalClock;
AdjustedClock m_adjustedClock;
openrtm-commit メーリングリストの案内