Package tangled :: Module core :: Class Worker
[hide private]
[frames] | no frames]

Class Worker

source code

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

This is a worker thread which executes a function and calls a callback on completion

Instance Methods [hide private]
 
__init__(self, reactor, autostart=False)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
stop(self)
Stops the worker
source code
 
_runner(self)
The message pump of the worker
source code
 
execute(self, func, oncomplete)
Executes func in the worker thread, which then calls oncomplete
source code
Deferred
defer(self, func)
Defers the call to func to this worker
source code

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

Inherited from threading.Thread (private): _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 object: __class__

Method Details [hide private]

__init__(self, reactor, autostart=False)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • reactor (Reactor) - The reactor this is a worker for.
  • autostart - If true, the worker thread starts immediately. Otherwise start() has to be called.
Overrides: object.__init__
(inherited documentation)

execute(self, func, oncomplete)

source code 

Executes func in the worker thread, which then calls oncomplete

Parameters:
  • oncomplete (callable)
  • func (callable)

defer(self, func)

source code 

Defers the call to func to this worker

Parameters:
  • func (callable) - The function you want the worker to call
Returns: Deferred
A Deferred object that will eventually get the result of func