python::AsyncCallThread::AsyncCallThread Class Reference

List of all members.

Public Member Functions

def __init__
def run

Public Attributes

 callback
 func
 args
 kwds
 result
 exception
 start_time
 stop_time


Detailed Description

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.


Member Function Documentation

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):


Member Data Documentation

python::AsyncCallThread::AsyncCallThread::callback

Definition at line 19 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::func

Definition at line 20 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::args

Definition at line 21 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::kwds

Definition at line 22 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::result

Definition at line 23 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::exception

Definition at line 24 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::start_time

Definition at line 25 of file AsyncCallThread.py.

python::AsyncCallThread::AsyncCallThread::stop_time

Definition at line 26 of file AsyncCallThread.py.


The documentation for this class was generated from the following file:
Generated on Mon Feb 18 14:42:02 2008 for gbs by  doxygen 1.5.4