[openrtm-commit:00333] r445 - branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist

openrtm @ openrtm.org openrtm @ openrtm.org
2011年 8月 9日 (火) 21:36:06 JST


Author: kurihara
Date: 2011-08-09 21:36:06 +0900 (Tue, 09 Aug 2011)
New Revision: 445

Modified:
   branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
   branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/Task.py
Log:
The bug of termination processing about thread has been corrected.

Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py	2011-08-09 12:33:12 UTC (rev 444)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/PeriodicExecutionContext.py	2011-08-09 12:36:06 UTC (rev 445)
@@ -376,6 +376,7 @@
     self._comps = []
     self._profile = RTC.ExecutionContextProfile(RTC.PERIODIC, rate_, None, [], [])
     self._ref = self._this()
+    self._mutex_del = threading.RLock()
 
     return
 
@@ -387,12 +388,14 @@
     self._worker._cond.notify()
     self._worker._cond.release()
     self._running = False
-    self.wait()
+    #self.wait()
 
     self._profile.owner = None
     self._profile.paarticipants = []
     self._profile.properties = []
+    guard = OpenRTM_aist.ScopedLock(self._mutex_del)
     Task.__del__(self)
+    del guard
 
   ##
   # @if jp
@@ -431,6 +434,7 @@
     self._rtcout.RTC_TRACE("svc()")
     flag = True
 
+    guard = OpenRTM_aist.ScopedLock(self._mutex_del)
     while flag:
       self._worker._cond.acquire()
       while not self._worker._running:
@@ -447,7 +451,7 @@
         time.sleep(sec_)
 
       flag = self._running
-
+    del guard
     return 0
 
 

Modified: branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/Task.py
===================================================================
--- branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/Task.py	2011-08-09 12:33:12 UTC (rev 444)
+++ branches/RELENG_1_1/OpenRTM-aist-Python/OpenRTM_aist/Task.py	2011-08-09 12:36:06 UTC (rev 445)
@@ -26,9 +26,10 @@
     
   def __del__(self):
     self._count = 0
-    if self._thread:
-      self._thread.join()
-      self._thread = None
+    #if self._thread:
+    #  if self._thread.isAlive():
+    #    self._thread.join()
+    self._thread = None
     return
 
 
@@ -49,7 +50,6 @@
       self._thread = threading.Thread(target=self.svc_run)
       self._count += 1
       self._thread.start()
-
     return
 
 



openrtm-commit メーリングリストの案内