Task.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: euc-jp -*-
3 
4 
17 
18 import threading
19 
20 class Task:
21  def __init__(self):
22  self._count = 0
23  self._thread = None
24  return
25 
26 
27  def __del__(self):
28  self._count = 0
29  #if self._thread:
30  # if self._thread.isAlive():
31  # self._thread.join()
32  self._thread = None
33  return
34 
35 
36  def open(self, args = None):
37  return 0
38 
39 
40  def close(self, flags = 0):
41  return 0
42 
43 
44  def svc(self):
45  return 0
46 
47 
48  def activate(self):
49  if self._count == 0:
50  self._thread = threading.Thread(target=self.svc_run)
51  self._count += 1
52  self._thread.start()
53  return
54 
55 
56  def wait(self):
57  if self._count > 0:
58  self._thread.join()
59  return
60 
61 
62  def suspend(self):
63  return 0
64 
65 
66  def resume(self):
67  return 0
68 
69 
70  def reset(self):
71  self._count = 0
72  return
73 
74 
75  def finalize(self):
76  self.reset()
77  return
78 
79  def svc_run(self):
80  self.svc()
81  self.finalize()
82  return
def finalize(self)
Definition: Task.py:75
def svc(self)
Definition: Task.py:44
def wait(self)
Definition: Task.py:56
def svc_run(self)
Definition: Task.py:79
def close(self, flags=0)
Definition: Task.py:40
def open(self, args=None)
Definition: Task.py:36
def activate(self)
Definition: Task.py:48
def suspend(self)
Definition: Task.py:62
def reset(self)
Definition: Task.py:70
def __del__(self)
Definition: Task.py:27
def __init__(self)
Definition: Task.py:21
def resume(self)
Definition: Task.py:66


openrtm_aist_python
Author(s): Shinji Kurihara
autogenerated on Thu Jun 6 2019 19:11:34