Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Static Public Attributes | Private Attributes
arcom.threadpool.ThreadPoolThread Class Reference

List of all members.

Public Member Functions

def __init__
def run
def goAway

Static Public Attributes

float threadSleepTime = 0.1

Private Attributes

 __pool
 __isDying

Detailed Description

Pooled thread class. 

Definition at line 130 of file threadpool.py.


Constructor & Destructor Documentation

def arcom.threadpool.ThreadPoolThread.__init__ (   self,
  pool 
)
Initialize the thread and remember the pool. 

Definition at line 136 of file threadpool.py.

00136 
00137     def __init__(self, pool):
00138 
00139         """ Initialize the thread and remember the pool. """
00140         
00141         threading.Thread.__init__(self)
00142         self.__pool = pool
00143         self.__isDying = False
        

Member Function Documentation

Exit the run loop next time through.

Definition at line 169 of file threadpool.py.

00169 
00170     def goAway(self):
00171 
00172         """ Exit the run loop next time through."""
00173         
00174         self.__isDying = True
00175 
00176             
# from http://my.safaribooksonline.com/0596001673/pythoncook-CHP-6-SECT-4
Until told to quit, retrieve the next task and execute
it, calling the callback if any.  

Definition at line 144 of file threadpool.py.

00144 
00145     def run(self):
00146 
00147         """ Until told to quit, retrieve the next task and execute
00148         it, calling the callback if any.  """
00149         
00150         while self.__isDying == False:
00151             cmd, args, callback = self.__pool.getNextTask()
00152             # If there's nothing to do, just sleep a bit
00153             if cmd is None:
00154                 sleep(ThreadPoolThread.threadSleepTime)
00155             elif callback is None:
00156                 if args is None:
00157                     cmd()
00158                 elif isinstance(args,list):
00159                     cmd(*args)
00160                 else:
00161                     cmd(args)
00162             else:
00163                 if args is None:
00164                     callback(cmd()) 
00165                 elif isinstance(args,list):
00166                     callback(cmd(*args))
00167                 else:
00168                     callback(cmd(args))
                    

Member Data Documentation

Definition at line 142 of file threadpool.py.

Definition at line 141 of file threadpool.py.

Definition at line 134 of file threadpool.py.


The documentation for this class was generated from the following file: