Package brisa :: Package core :: Module threaded_call :: Class ThreadedCall
[hide private]
[frames] | no frames]

Class ThreadedCall

source code

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

This class runs a call asynchronously and forwards the result/error to specified callbacks.

One can instantiate this class directly or use the run_async_call function located at package brisa.core.threaded_call.

Instance Methods [hide private]
 
__init__(self, function, success_callback=None, error_callback=None, success_callback_cargo=None, error_callback_cargo=None, delay=None, *args, **kwargs)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
cleanup(self)
Removes references to objects that may hurt garbage collection
source code
 
is_cancelled(self) source code
 
run(self)
Implementation of the call procedure.
source code
 
cancel(self)
Cancel the call.
source code
 
stop(self)
Prepares to stop.
source code
 
is_completed(self)
Returns whether the call has been completed or not.
source code
 
set_completed(self)
Sets the call as completed.
source code

Inherited from threading.Thread: __repr__, daemon, getName, ident, isAlive, isDaemon, is_alive, join, name, 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 object: __class__

Method Details [hide private]

__init__(self, function, success_callback=None, error_callback=None, success_callback_cargo=None, error_callback_cargo=None, delay=None, *args, **kwargs)
(Constructor)

source code 

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

Parameters:
  • function (callable) - function to be called passing *args and **kwargs
  • success_callback (callable) - called in case of success, receives call result
  • error_callback (callable) - called in case of error, receives call result
  • delay (float) - time to be wait before performing the call
  • args - arguments to the function
  • kwargs - arguments to the function
Overrides: object.__init__
(inherited documentation)

run(self)

source code 

Implementation of the call procedure.

Overrides: threading.Thread.run

set_completed(self)

source code 

Sets the call as completed. This should not be called directly. Use stop() instead.