New topic: Program Flow Question
<http://forums.realsoftware.com/viewtopic.php?t=45145> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message tseyfarth Post subject: Program Flow QuestionPosted: Mon Aug 27, 2012 11:50 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 672 Hello all, This might seem sort of basic, and it probably is, but sometimes my mind gets wrapped up (or warped) and rationalizes a question in two different ways! In an event driven environment such as RS, if for example a Serial Data event is fired, the applications flow is stopped and restarted in the event fired. When that event code is finished, it returns back to wherever it was. Correct? But, what if the app was not executing any code - just sitting there before the event fired. Once in the event, if a sub or function is called, one mind set tells me that this new code is executed, then the flow is returned back to the event code until it is finished and the Return method is encountered. But, what if one wanted to leave the Serial Data event, and NOT return to it. Does the calling of a sub effectively do this? If not, how to do it? In a Console type app, there is main loop. Just like the uC world. This is a "Central" place where the program flow always returns to. But in event driven world (which a Console can be when it incorporates object like Serial), there is no real central location or program loop - right? Further, in an event driven environment, if a loop were used - especially a do nothing loop, very high CPU usage occurs - at least this has been my experience in VB6. Alternatively, using a short, repetitive timer, is kind of the same thing AND it may also interfere with another objects events, since the timer is likely to go off while executing the event code of the other object (Serial in this example). While the timer *could* be stopped, it would then have to be stopped everywhere an event may be triggered. And also restarted too.... seems like a lot to work through. So, I think that as one ponders this, more and more examples might be conjured. So rather than continue, I ask, what are your thoughts on the subject? Thank you in advance! Tim Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml rbforumnotifier@monkeybreadsoftware.de