[openrtm-commit:01102] r589 - trunk/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2013年 6月 27日 (木) 18:02:08 JST


Author: n-ando
Date: 2013-06-27 18:02:07 +0900 (Thu, 27 Jun 2013)
New Revision: 589

Modified:
   trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
Log:
Problem about signal.alarm() on Windows has been solved. refs #2772

Modified: trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py
===================================================================
--- trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2013-06-03 15:11:04 UTC (rev 588)
+++ trunk/OpenRTM-aist-Python/OpenRTM_aist/Manager.py	2013-06-27 09:02:07 UTC (rev 589)
@@ -48,7 +48,25 @@
 # @endif
 mutex = threading.RLock()
 
+##
+# @if jp
+# @brief Windows用Alarm
+# @else
+# @brief Alarm for Windows
+# @endif
+import os
+import time
+import threading
 
+class Alarm (threading.Thread):
+  def __init__ (self, timeout):
+    threading.Thread.__init__ (self)
+    self.timeout = timeout
+    self.setDaemon(True)
+  def run (self):
+    time.sleep(self.timeout)
+    os._exit(1)
+
 ##
 # @if jp
 # @brief 終了処理
@@ -64,10 +82,14 @@
 def handler(signum, frame):
   mgr = OpenRTM_aist.Manager.instance()
   mgr.terminate()
-  signal.alarm(2)
+  import os
+  if os.sep == '/':
+    signal.alarm(2)
+  else:
+    alarm = Alarm(2)
+    alarm.start()
 
 
-
 ##
 # @if jp
 # @class Manager
@@ -380,8 +402,8 @@
       return False
 
     lsvc_ = [s.strip() for s in self._config.getProperty("manager.local_service.modules").split(",")]
-    if len(svc_) == 0: continue
     for svc_ in lsvc_:
+      if len(svc_) == 0: continue
       basename_ = svc_.split(".")[0]+"Init"
       try:
         self._module.load(svc_, basename_)
@@ -792,7 +814,6 @@
     comp_prop = OpenRTM_aist.Properties()
     comp_id   = OpenRTM_aist.Properties()
 
-    print "comp_args:", comp_args
     if not self.procComponentArgs(comp_args, comp_id, comp_prop):
       return None
 



More information about the openrtm-commit mailing list