[Pvfs2-developers] state machine ending
Sam Lang
slang at mcs.anl.gov
Mon Jul 24 18:08:05 EDT 2006
On Jul 24, 2006, at 2:07 PM, Pete Wyckoff wrote:
> walt at clemson.edu wrote on Mon, 24 Jul 2006 14:47 -0400:
>> 3) the state machine language has a keyword that lets you state
>> that the
>> next state is "terminate" which could be used to finish the state
>> machine, but right now the code has logic that detects this and
>> prints a
>> warning that you should NOT use this. I don't know why we created
>> this
>> method and then made it illegal. Go figure!
>
> I prefer #3 by a large margin over the other options. It's
> explicit, not racy, doesn't over-use the return value for a
> conceptually different event, and doesn't rely on modifying
> parent state. Wonder why it was disabled.
>
I think terminate ended up being more of a placeholder...we still use
it in quite a few of our state machines, but the last state action is
expected to call server_state_machine_complete which prevents the SM
from transitioning to the 'terminate' state. I've thought of it as
an assert: if you get here you're forgetting something.
It sounds like option 3 is best. My only concern would be using the
state machine definition to define completion makes me forget about
cleaning up in the last action (or actions). I wouldn't mind seeing
option 3 and option 4 being required: check the return code and make
sure the next state is 'terminate'. If one of those fails there's a
bug in the code. I think that might help (at least me) verify that
state actions that are meant to complete need to do cleanup first.
-sam
> Regarding names, STATE_COMPLETE and STATE_MACHINE_TERMINATED seem
> like find candidates as you have sort of suggested.
>
> My pocket change.
>
> -- Pete
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers
>
More information about the Pvfs2-developers
mailing list