Public Member Functions | |
| def | __init__ |
| def | run |
Public Attributes | |
| callback | |
| func | |
| args | |
| kwds | |
| result | |
| exception | |
| start_time | |
| stop_time | |
Asynchronous function call thread. The result of call func(*args,**kwds) is stored in the result attribute. If an exception is raised the exception object is stored in the exception attribute. Otherwise the exception attribute is None. The caller is notified with the callback(t) where t is this thread object.
Definition at line 10 of file AsyncCallThread.py.
| def python::AsyncCallThread::AsyncCallThread::__init__ | ( | self, | ||
| callback, | ||||
| func, | ||||
| args, | ||||
| kwds | ||||
| ) |
Definition at line 17 of file AsyncCallThread.py.
00017 : 00018 Thread.__init__(self,name = 'async_call_%s'%func.__name__) 00019 self.callback = callback 00020 self.func = func 00021 self.args = args 00022 self.kwds = kwds 00023 self.result = None 00024 self.exception = None 00025 self.start_time = 0 00026 self.stop_time = 0 00027 self.setDaemon(True) #This allows python to end even if thread still active. 00028 def run(self):
| def python::AsyncCallThread::AsyncCallThread::run | ( | self | ) |
Definition at line 29 of file AsyncCallThread.py.
00029 : 00030 self.start_time = time.time() 00031 00032 try: 00033 print "Making asynchronous call:",self.func.__name__,self.args,self.kwds 00034 self.result = self.func(*self.args,**self.kwds) 00035 except Exception,x: 00036 self.exception = x 00037 00038 self.stop_time = time.time() 00039 self.callback(self) 00040 00041 def async_call(callback,func, *args, **kwds):
Definition at line 19 of file AsyncCallThread.py.
Definition at line 20 of file AsyncCallThread.py.
Definition at line 21 of file AsyncCallThread.py.
Definition at line 22 of file AsyncCallThread.py.
Definition at line 23 of file AsyncCallThread.py.
Definition at line 24 of file AsyncCallThread.py.
Definition at line 25 of file AsyncCallThread.py.
Definition at line 26 of file AsyncCallThread.py.
1.5.4