Home | Trees | Indices | Help |
|
---|
|
object --+ | Task
Create a new Task when you have some long running function to run in the background, but which needs to do work in 'chunks'. Example:
>>> from zeroinstall import tasks >>> def my_task(start): for x in range(start, start + 5): print "x =", x yield None
>>> tasks.Task(my_task(0)) >>> tasks.Task(my_task(10)) >>> mainloop()
Yielding None gives up control of the processor to another Task, causing the sequence printed to be interleaved. You can also yield a Blocker (or a list of Blockers) if you want to wait for some particular event before resuming (see the Blocker class for details).
Instance Methods | |||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
Call next(iterator) from a glib idle function. This function can yield Blocker() objects to suspend processing while waiting for events. name is used only for debugging.
|
repr(x)
|
str(x)
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 26 18:14:07 2013 | http://epydoc.sourceforge.net |