467,915 Members | 1,701 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,915 developers. It's quick & easy.

General design question relating to FSM.

Hi
I am looking for any articles anyone may know of on developing a finite
state machine in a gui application?
Basically what I have is a fairly complex gui which needs to go through
several (3 - 7?) states. Complex algorithms are running as their own
separate code blocks operating on class-level data structures, the
completion of the processing of one set of data takes the application from
one 'state' to another. Once the last operation is complete, some user
activity will probably have occurred on the user interface that makes it
'dirty' and means the first operation has to start again, to cycle the
transition of repopulating the data structures to update them.
I've decided to go down the multithreading road, because the operations take
too long (a few whole seconds) for them to execute in the primary thread of
the user interface as they block it up, but there probably IS time for them
all to run in time to 'keep up' with the user entering data as they cannot
enter a lot of data incessantly fast all the time (or probably won't) - as
the time they have to lock some actual elements on the interface is
negligible compared to the total time they will take to run.
What's more, there are some cases which will be identified where the first
process can start again before the last one of the previous cycle has
completely finished, enabling a multithreading scenario to take advantage of
this.
What's the best way of accomplishing this? I'm trying to work on a suitable
class structure.
Nov 16 '05 #1
  • viewed: 1892
Share:
2 Replies
"Beeeeeves" <1234512345789123456789> wrote in message news:uJ**************@TK2MSFTNGP09.phx.gbl...
I've decided to go down the multithreading road, because the operations take
too long (a few whole seconds)


The simplest approach is to have one GUI thread (the main thread)
and one worker thread (background, non-GUI). The worker thread
will own the FSM. Arrange user actions on the GUI to cause the GUI
thread to post messages to the worker thread which will act on them when
finished with any preexisting work.

Nov 16 '05 #2
Beeeeeves wrote:
Hi
I am looking for any articles anyone may know of on developing a finite
state machine in a gui application?


You could take a look at the fsm library in the boost sandbox.
Documentation index is

http://cvs.sourceforge.net/viewcvs.p...doc/index.html

and a tutorial at

http://cvs.sourceforge.net/viewcvs.p.../tutorial.html

The document and code are in

http://cvs.sourceforge.net/viewcvs.p...dbox/libs/fsm/
http://cvs.sourceforge.net/viewcvs.p...box/boost/fsm/

There is quite a lot of discussion going on about this library at the
moment on the boost libs. I haven't been able to try it myself as it
doesn't work with bcc32 which is my current compiler, but I am
interested in it because we do implement a lot of state machines here.
You could get more help with it from the boost newsgroups if interested.

Cheers

Russell
Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Chris | last post: by
reply views Thread by JKJ | last post: by
3 posts views Thread by reageer | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.