Package kiwi :: Module tasklet :: Class Tasklet
[frames | no frames]

Type Tasklet

object --+
         |
        Tasklet


An object that launches and manages a tasklet.
Method Summary
  add_join_callback(self, callback)
Add a callable to be invoked when the tasklet finishes.
  get_message_actions(self)
Dictionary mapping message names to actions ('accept' or 'discard' or 'defer').
  remove_join_callback(self, handle)
Remove a join callback previously added with add_join_callback
  run(self)
Method that executes the task.
  send_message(self, message)
Send a message to be received by the tasklet as an event.
  wait_condition_fired(self, triggered_cond)
Method that should be called when a wait condition fires

Property Summary
  message_actions

Class Variable Summary
int STATE_MSGSEND = 2                                                                     
int STATE_RUNNING = 0                                                                     
int STATE_SUSPENDED = 1                                                                     

Method Details

add_join_callback(self, callback)

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)

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 remove_join_callback afterwards produces a KeyError exception.

get_message_actions(self)

Dictionary mapping message names to actions ('accept' or 'discard' or 'defer'). Should normally not be accessed directly by the programmer.

remove_join_callback(self, handle)

Remove a join callback previously added with add_join_callback

run(self)

Method that executes the task.

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

send_message(self, message)

Send a message to be received by the tasklet as an event.

Warning: 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.

wait_condition_fired(self, triggered_cond)

Method that should be called when a wait condition fires

Property Details

message_actions

Get Method:
get_message_actions(self)

Class Variable Details

STATE_MSGSEND

Type:
int
Value:
2                                                                     

STATE_RUNNING

Type:
int
Value:
0                                                                     

STATE_SUSPENDED

Type:
int
Value:
1                                                                     

Generated by Epydoc 2.1 on Thu Oct 19 03:18:14 2006 http://epydoc.sf.net