Dbus and FSM's

Robert Rawlins robert_rawlins at hotmail.com
Sat Feb 16 03:19:45 PST 2008


Hello Avery,
 > On 15/02/2008, Robert Rawlins <robert_rawlins at hotmail.com> wrote:> > I do startProcess()> > startProcess() calls back with processStarted()> > processStarted() then starts soSomthing()> > doSomthing calls back with somthingDone()> > somethingDone() then started doAnotherThing()> > doAnotherThing() calls back and starts doTheLastThing()> >> > Do you see what I mean? a link of function calls and callbacks which cause> > a chain reaction and progress the particular element of the application to> > go through its states.> > [...]> > After looking around this morning it would seem that a> > Finite State Machine is designed to manage this kind of process for me, is> > that correct?> > Actually, the process you described is already a finite state machine> :) FSMs are really just a way of thinking about programs that go> through a series of states. The math doesn't particularly help you> implement one.> > I think what you might want are "continuations" or "coroutines." In> C++, the WvStreams library contains a class called WvCont that does it> very nicely: http://alumnit.ca/wvstreams/docs/wvcont_8h-source.html> > If you're using .net (mono / C#), I wrote a simple implementation of> the same thing using (weirdly enough) .net iterators:> http://www.advogato.org/person/apenwarr/diary/358.html> > You can do something similar with raw setjmp/longjmp, but I'm not sure> you want to get into that :)> > Another option is to use blocking dbus method calls in a thread,> although threads introduce their own set of problems.> > Have fun,> > Avery
 
Thanks for the thorough explanation :-) This is all a new and alien concept to me, I come from a background in web development so the hole concept of automated applications and event driven models is very new to me.
 
I see what you mean about my current process being an Finite State Machine of sorts, I've just been looking around at a few examples of creating an FSM class which you can implement into the application which contains a table of transactions and states and their associated methods. I cant really see any real benefit to me implementing one as the application seems to run just peachy as is, I was just interested to see how it might implement from a technical learning exercise point of view.
Thanks for the suggestions Avery, I apprecaite it,
 
Robert
_________________________________________________________________
Who's friends with who and co-starred in what?
http://www.searchgamesbox.com/celebrityseparation.shtml
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20080216/0d6af52e/attachment.htm 


More information about the dbus mailing list