This project is read-only.

State Machine and Threads

  • What thread does the State Machine run on?
  • Are calls to the State Machine synchronous or Asynchronous?
  • How do I wait for the state machine to reach a certain state or trigger?
  • How do I cancel the state machine?

Design Principles

  • The State Machine should provide a simple synchronous interface.
  • The State Machine should also provide an asynchronous interface. Async operations will use a (Verb)Async structure to indicate an async operation.
  • The State Machine should allow callers to provide a SynchronizationContext


Start a state machine

After you define a state machine, then what?
State machines react to events so one approach would simply be to start the state machine. The API has to clearly indicate if you are doing a synchronous operation or an async operation.

For example:
// Run with no parameters means to run synchronously until the state machine completes, aborts or has a timeout.  
// It runs on a thread from the threadpool (using WorkflowApplication)

// Run until the stateMachine becomes idle with an active trigger 

// You can also run without blocking the calling thread

// You can run and then wait for the trigger. 

Last edited Jun 15, 2011 at 2:24 AM by ronjacobs, version 2


No comments yet.