Part of kiwi.tasklet View In Hierarchy
Instance Variables | state | current execution state of the tasklet, one of the STATE_* contants. |
return_value | the value returned by the task function, or None. | |
Class Variables | STATE_RUNNING | the tasklet function is currently executing code |
STATE_SUSPENDED | the tasklet function is currently waiting for an event | |
STATE_MSGSEND | the tasklet function is currently sending a message | |
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 |
Method | get_message_actions | Dictionary mapping message names to actions ('accept' or |
Method | run | Method that executes the task. |
Method | _invoke | Undocumented |
Method | _next_round | Undocumented |
Method | _dispatch_message | get next message that a tasklet wants to receive; discard |
Method | _update_wait_conditions | disarm wait conditions removed and arm new wait conditions |
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. |
Method | remove_join_callback | Remove a join callback previously added with add_join_callback
|
Method | _join | Undocumented |
Method | send_message | Send a message to be received by the tasklet as an event. |
Parameters | gen | a generator object that implements the tasklet main body |
start | whether to automatically start running the tasklet in the constructor If `gen` is omitted or None,run should be
overridden in a subclass.
|
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. |
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 callingremove_join_callback
afterwards produces a KeyError exception.
add_join_callback
Note | Don't call this from another tasklet, only from the main loop! To send
a message from another tasklet, yield a Message with a correctly
set 'dest' parameter.
|