Package pysys :: Package utils :: Module threadpool :: Class WorkerThread
[hide private]
[frames] | no frames]

Class WorkerThread

source code

        object --+        
                 |        
threading._Verbose --+    
                     |    
      threading.Thread --+
                         |
                        WorkerThread

Thread to perform work requests managed by the thread pool object.

The thread polls the thread safe queue of the thread pool instance to retrieve work requests in the form of a callable reference with parameters. On completion of a work request the thread places the results on another thread safe queue of the thread pool and waits to get a new request.

Instance Methods [hide private]
 
__init__(self, requests_queue, results_queue, poll_timeout=5, **kwds)
Class constructor.
source code
 
run(self)
Start running the worker thread.
source code
 
dismiss(self)
Stop running of the worker thread.
source code

Inherited from threading.Thread: __repr__, getName, isAlive, isDaemon, is_alive, join, setDaemon, setName, start

Inherited from threading.Thread (private): _reset_internal_locks, _set_daemon, _set_ident

Inherited from threading._Verbose (private): _note

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from threading.Thread: daemon, ident, name

Inherited from threading.Thread (private): _block

Inherited from object: __class__

Method Details [hide private]

__init__(self, requests_queue, results_queue, poll_timeout=5, **kwds)
(Constructor)

source code 

Class constructor.

Parameters:
  • requests_queue - Reference to the threadpool's request queue
  • results_queue - Reference to the threadpool's results queue
  • poll_timeout - The timeout when trying to obtain a request from the request queue
  • kwds - Variable arguments to be passed to the threading.Thread constructor
Overrides: object.__init__

run(self)

source code 

Start running the worker thread.

Overrides: threading.Thread.run