On Wed, 11 Aug 2010 05:09:37 +0100, Gloria W <[email protected]> wrote:
Finally, I've been doing a fair amount of time related work using
kamaelia
recently, and I'm very much of the opinion that using time.sleep inside
a
threaded component is by far and away the most simple thing to do.
Yes :-)
The timer solution makes sense. I wrote timer code which looks almost
exactly like Matt's timer class. I pass it through a series of
components, where one happens to be a threadedcomponent, and it breaks.
This solution is fool-proof.
Yes, forgot to mention that that TimerMixin experiment would break if
mixed-in with a threadedcomponent - in which situation using time.sleep()
is far simpler and less heavyweight.
Matt: Please try this with your code, self.link() it to a chain of
components where one is threaded, or run the entire chain with a
scheduler.run.runThreads() call, and let me know what you see. My code
is very very similar to yours and fails after the timer is fired. I
cannot cancel the timer, I cannot control it at all, as if I have lost
control of the thread. A thread inside a thread is just craziness. :)
I'm not sure I fully understand what you are suggesting. I've tried
putting it in a pipeline with a threadedcomponent, and that seems to work
fine:
http://code.google.com/p/kamaelia/source/browse/trunk/Sketches/MH/TimerMixIn.py
On the other hand, maybe you are making the point that this mixin doesn't
work when mixed-in with threadedcomponent? Which I 100% agree with.
*if* it were to become core functionality of Kamaelia, then I'd envisage
it being added to Component; and similar methods providing equivalent
functionality being added to threadedcomponent.
--
| Matt Hammond
| Research Engineer, BBC R&D, Centre House, London
| http://www.bbc.co.uk/rd/
--
You received this message because you are subscribed to the Google Groups
"kamaelia" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/kamaelia?hl=en.