Skip to content

Instantly share code, notes, and snippets.

@wesbillman
Created January 21, 2010 17:42
Show Gist options
  • Save wesbillman/282984 to your computer and use it in GitHub Desktop.
Save wesbillman/282984 to your computer and use it in GitHub Desktop.
static e_STATE current_state;
void main_thread()
{
switch(current_state)
{
case STATE_A:
state_a();
break;
...
}
}
void state_a()
{
MESSAGE message;
while(current_state == STATE_A)
{
receive_message(&message)
switch(message.type)
{
case MESSAGE_A:
//do a bunch of message a stuff...
break;
...
}
}
}
...
typedef enum {
STATE_A,
STATE_B,
STATE_C
} e_STATE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment