Module threadpool :: Class WorkerThread
[frames] | no frames]

Class WorkerThread

source code

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

Background thread connected to the requests/results queues.

A worker thread sits in the background and picks up work requests from one queue and puts the results in another until it is dismissed.

Instance Methods
 
__init__(self, requests_queue, results_queue, poll_timeout=5, **kwds)
Set up thread in daemonic mode and start it immediatedly.
source code
 
run(self)
Repeatedly process the job queue until told to exit.
source code
 
dismiss(self)
Sets a flag to tell the thread to exit when done with current job.
source code

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

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

Properties

Inherited from threading.Thread: daemon, ident, name

Inherited from object: __class__

Method Details

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

source code 

Set up thread in daemonic mode and start it immediatedly.

requests_queue and results_queue are instances of Queue.Queue passed by the ThreadPool class when it creates a new worker thread.

Overrides: object.__init__

run(self)

source code 
Repeatedly process the job queue until told to exit.
Overrides: threading.Thread.run