03-14-2008 04:17 PM - edited 03-14-2008 04:25 PM
1] In most of my application I used QSM with event structure which was in one of the cases
- This approach has the disadvantage that if some of the states takes longer time the GUI doesn't respond immediately to the user actions. It freezes.
+ Big advantage of this is it's simplicity
see picture1 as an example of [1]
2] Now after reading very nice article I decided to put the event structure in separate loop which assures that every time the user acts it puts appropriate states to the end of the queue for further processing
+ no GUI freezing
- Imagine a situation when state1 is being processed and it takes long time. On the output from this state states2 and state3 should be added to the end of the queue. Meanwhile the user presses button that causes state4 to be add at the end of the queue.
The desired sequence of the states should be state1->state2->state3->state4
Nevertheless it actually can happen to be state1->state4->state2->state3
But it can be handled by locking the front panel programmatically
see picture2 as an example of [2]
So my first question is which approach do you use and why?
My second question is pointed on users of the second method with the separate UI loop. What do you do with errors there? If using the first method it is easy to handle error in general. Before dequeueing you just check if there is some error and if so you go to an error state to handle it.
Using [2] you can do it in the Main Loop but what if error happens in the UI loop?
03-19-2008 10:37 AM
03-20-2008 01:24 PM