Task.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: euc-jp -*-
00003 
00004 ##
00005 # @file Task.py
00006 # @brief Task class
00007 # @date $Date$
00008 # @author Noriaki Ando <n-ando@aist.go.jp> and Shinji Kurihara
00009 #
00010 # Copyright (C) 2008
00011 #     Task-intelligence Research Group,
00012 #     Intelligent Systems Research Institute,
00013 #     National Institute of
00014 #         Advanced Industrial Science and Technology (AIST), Japan
00015 #     All rights reserved.
00016 #
00017 
00018 import threading
00019 
00020 class Task:
00021   def __init__(self):
00022     self._count = 0
00023     self._thread = None
00024     return
00025 
00026     
00027   def __del__(self):
00028     self._count = 0
00029     #if self._thread:
00030     #  if self._thread.isAlive():
00031     #    self._thread.join()
00032     self._thread = None
00033     return
00034 
00035 
00036   def open(self, args = None):
00037     return 0
00038 
00039 
00040   def close(self, flags = 0):
00041     return 0
00042 
00043 
00044   def svc(self):
00045     return 0
00046 
00047 
00048   def activate(self):
00049     if self._count == 0:
00050       self._thread = threading.Thread(target=self.svc_run)
00051       self._count += 1
00052       self._thread.start()
00053     return
00054 
00055 
00056   def wait(self):
00057     if self._count > 0:
00058       self._thread.join()
00059     return
00060 
00061 
00062   def suspend(self):
00063     return 0
00064 
00065 
00066   def resume(self):
00067     return 0
00068 
00069 
00070   def reset(self):
00071     self._count = 0
00072     return
00073 
00074 
00075   def finalize(self):
00076     self.reset()
00077     return
00078 
00079   def svc_run(self):
00080     self.svc()
00081     self.finalize()
00082     return


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Aug 27 2015 14:17:28