An object that launches and manages a tasklet.

@ivar state: current execution state of the tasklet, one of the STATE_* contants.

@ivar return_value: the value returned by the task function, or None.

@cvar STATE_RUNNING: the tasklet function is currently executing code
@cvar STATE_SUSPENDED: the tasklet function is currently waiting for an event
@cvar STATE_MSGSEND: the tasklet function is currently sending a message
@cvar STATE_ZOMBIE: the tasklet function has ended
Method __init__ Launch a generator tasklet.
Method start Starts the execution of the task, for use with tasklets created with start=False
Method get_message_actions Dictionary mapping message names to actions ('accept' or 'discard' or 'defer'). Should normally not be accessed directly by the programmer.
Method run Method that executes the task.
Method wait_condition_fired Method that should be called when a wait condition fires
Method add_join_callback Add a callable to be invoked when the tasklet finishes. Return a connection handle that can be used in remove_join_callback()
Method remove_join_callback Remove a join callback previously added with L{add_join_callback}
Method send_message Send a message to be received by the tasklet as an event.
Method _invoke Undocumented
Method _next_round Undocumented
Method _dispatch_message get next message that a tasklet wants to receive; discard messages that should be discarded
Method _update_wait_conditions disarm wait conditions removed and arm new wait conditions
Method _join Undocumented
def __init__(self, gen=None, start=True):
Launch a generator tasklet.

@param gen: a generator object that implements the tasklet main body
@param start: whether to automatically start running the tasklet in the constructor

If `gen` is omitted or None, L{run} should be overridden in a
subclass.
def start(self):
Starts the execution of the task, for use with tasklets
created with start=False
def get_message_actions(self):
Dictionary mapping message names to actions ('accept' or
'discard' or 'defer').  Should normally not be accessed
directly by the programmer.
def run(self):
Method that executes the task.

Should be overridden in a subclass if no generator is passed
into the constructor.

@note: do NOT call this method directly; it is meant to be called by
the tasklet framework.
def _invoke(self):
Undocumented
def _next_round(self):
Undocumented
def _dispatch_message(self):
get next message that a tasklet wants to receive; discard
messages that should be discarded
def _update_wait_conditions(self, old_wait_list):
disarm wait conditions removed and arm new wait conditions
def wait_condition_fired(self, triggered_cond):
Method that should be called when a wait condition fires
def add_join_callback(self, callback, *extra_args):
Add a callable to be invoked when the tasklet finishes.
Return a connection handle that can be used in
remove_join_callback()

The callback will be called like this::
      callback(tasklet, retval, *extra_args)
where tasklet is the tasklet that finished, and retval its
return value (or None).

When a join callback is invoked, it is automatically removed,
so calling L{remove_join_callback} afterwards produces a KeyError
exception.
def remove_join_callback(self, handle):
Remove a join callback previously added with L{add_join_callback}
def _join(self, retval):
Undocumented
def send_message(self, message):
Send a message to be received by the tasklet as an event.

@note: Don't call this from another tasklet, only from the
main loop!  To send a message from another tasklet, yield a
L{Message} with a correctly set 'dest' parameter.
API Documentation for Kiwi, generated by pydoctor at 2019-08-08 02:24:42.