![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Where to call start() Topic Summary: Created On: 20-Mar-2007 00:56 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
Hi,
I have an active class, Keyboard, where I have overridden the thread loop operation: OMReactive* OMThread::execute(). When I do that, I have to call Keyboard::start() to get it all going. The question is then where to call start() !? I have observed, that it has a huge impact on the animation performance when and where it is called. (The only thing that start() does, is resume the newly created thread, which was created suspended.) 1) If it is called in the constructor, it slows down the animation. 2) If I make a statechart on the Keyboard class, with only one state and with start() called on the initial transition, it seem to work very well, but why? And with execute() overridden, there is no event handling left, so the statechart is completly useless for anything else, so it seems like a pretty stupid way to do it! 3) If I switch off animation for the execute() operation and call start() in the constructor, it also works! This is what I'm doing right now. Where am I supposed to call start()? ... and can anybody tell me what is going on with the animation? Regards ------------------------- Jesper Gissel Johnson Controls Denmark, Marine Controls |
|
![]() |
|
![]() |
|
Three things:
When overloading OMThread::execute() it is always a good idea to disable animation for it... it is an operation that never ends. Since Rhapsody v6.0 you should invoke startDispatching() instead of invoking start(). Third: The best time to call startDispatching() is after the initialization of your application has completed (all objects instantiated, all relationships initialized, all statemachine behaviors initialized). Typically it is done from outside of the class instance. The one who called something like pKeyboard = new Keyboard; should later on call pKeyboard->startDispatching(); Hope that helps. |
|
![]() |
|
![]() |
|
Hi Martin,
Thank you for your answer. That helped a lot. But there's one thing I don't understand: [QUOTE]When overloading OMThread::execute() it is always a good idea to disable animation for it... it is an operation that never ends.[/QUOTE]Why is this a good thing? ------------------------- Jesper Gissel Johnson Controls Denmark, Marine Controls |
|
![]() |
Telelogic Rhapsody
» Rhapsody Category » Rhapsody
»
Where to call start()
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.