For examples and more explanations, see the module level docs. class threadedadaptivecommscomponent(threadedcomponent, Axon.AdaptiveCommsComponent._AdaptiveCommsable)threadedadaptivecommscomponent([queuelengths]) -> new threadedadaptivecommscomponent Base class for a version of an Axon adaptivecommscomponent that runs main() in a separate thread (meaning it can, for example, block). Subclass to make your own. Internal queues buffer data between the thread and the Axon inboxes and outboxes of the component. Set the default queue length at initialisation (default=1000). Like an adaptivecommscomponent, inboxes and outboxes can be added and deleted at runtime. A simple example: class IncrementByN(Axon.ThreadedComponent.threadedcomponent): Inboxes = { "inbox" : "Send numbers here", "control" : "NOT USED", } Outboxes = { "outbox" : "Incremented numbers come out here", "signal" : "NOT USED", } def __init__(self, N): super(IncrementByN,self).__init__() self.n = N def main(self): while 1: while self.dataReady("inbox"): value = self.recv("inbox") value = value + self.n self.send(value,"outbox") if not self.anyReady(): self.pause() Methods defined here_unsafe_addInbox(self, *args)Internal thread-unsafe code for adding an inbox. addInbox(self, *args)Allocates a new inbox with name based on the name provided. If a box with the suggested name already exists then a variant is used instead. Returns the name of the inbox added. addOutbox(self, *args)Allocates a new outbox with name based on the name provided. If a box with the suggested name already exists then a variant is used instead. Returns the name of the outbox added. deleteInbox(self, name)Deletes the named inbox. Any messages in it are lost. Try to ensure any linkages to involving this outbox have been destroyed - not just ones created by this component, but by others too! Behaviour is undefined if this is not the case, and should be avoided. deleteOutbox(self, name)Deletes the named outbox. Try to ensure any linkages to involving this outbox have been destroyed - not just ones created by this component, but by others too! Behaviour is undefined if this is not the case, and should be avoided. Methods inherited from Axon.ThreadedComponent.threadedcomponent :
Methods inherited from Axon.Component.component :
Methods inherited from Axon.Microprocess.microprocess :
Methods inherited from Axon.AdaptiveCommsComponent._AdaptiveCommsable :
FeedbackGot 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, 01 Feb 2010 at 04:00:28 UTC/GMT |
Kamaelia
is an open source project originated from and guided by BBC
Research. For more information browse the site or get in
contact.
This is an ongoing community based development site. As a result the contents of this page is the opinions of the contributors of the pages involved not the organisations involved. Specificially, this page may contain personal views which are not the views of the BBC. (the site is powered by a wiki engine)
(C) Copyright 2008 Kamaelia Contributors, including the British Broadcasting Corporation, All Rights Reserved