August'24: Kamaelia is in maintenance mode and will recieve periodic updates, about twice a year, primarily targeted around Python 3 and ecosystem compatibility. PRs are always welcome. Latest Release: 1.14.32 (2024/3/24)
For examples and more explanations, see the module level docs.
microprocess([thread][,closeDownValue]) -> new microprocess object
Creates a new microprocess object (not yet activated). You can optionally specify an alternative generator to be used instead of the one the microprocess would ordinarily create for itself.
Keyword arguments:
Microprocess initialiser.
Subclasses must call this using the idiom super(TheClass, self).__init__()
Standard function for rendering the object as a string.
Stub method that is overridden internally in Axon but not clients
Called by scheduler to ask microprocess to perform any desired shutdown tasks. The scheduler also processes any IPC objects in the return value.
Returns True if the microprocess is active and awake, or paused.
This query is actually passed on to this microprocess's scheduler.
Returns True if this microprocess has been running but has since been halted or terminated of its own accord. Otherwise returns False.
This contains the mainloop for a microprocess, returning a generator object. Creates the thread of control by calling the class's main method, then in a loop repeatedly calls the resulting generator's next method providing the object with time slices. After each time slice, the _microprocessGenerator yields control back to its caller.
Keyword arguments:
DEPRECATED - use M.unpause() instead
Call to activate this microprocess, so it can start to be executed by a scheduler. Usual usage is to simply call x.activate()
You can optionally specify a specific scheduler or tracker to use (instead of the defaults). You can also specify that a different method is the 'main' generator.
Keyword arguments:
'main' thread of execution stub function. Client classes are expected to override this.
Write your replacement as a generator (a method with 'yield' statements in it). 'Yield' any non-zero values you like regularly to hand control to the scheduler so other microprocesses can get a turn at executing. Your code must therefore not block - eg. waiting on a system call or event.
If you miss this off a class that directly subclass's microprocess, your program will run, but it will not do what you want!
Calls next() of the internal generator - lets you drop a microprocess in somewhere where you'd ordinarily stick a generator.
Internally this calls self.__thread.next() to pass the timeslice down to the actual generator
Pauses the microprocess.
If done by the microprocess itself, the microprocess will pause at the next point it 'yields'.
Internally, the request is forwarded to this microprocesses scheduler.
run - starts the scheduler for this microprocess and runs it.
This is a convenient shortcut to activate and run this microprocess and any other microprocesses that have already been activated (with the same scheduler).
Halts the microprocess, no way to "unstop"
Un-pauses the microprocess.
This is provided to allow other microprocesses to 'wake up' this one. This can only be performed by an external microprocess - if you are paused there is no way you can unpause yourself!
Does nothing if microprocess has been stopped.
Internally, the request is forwarded to this microprocess's scheduler.
Got a problem with the documentation? Something unclear that could be clearer? Want to help improve it? Constructive criticism is very welcome - especially if you can suggest a better rewording!
Please leave you feedback here in reply to the documentation thread in the Kamaelia blog.
-- Automatic documentation generator, 09 Dec 2009 at 04:00:25 UTC/GMT