-
-
Save wesbillman/282984 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
... | |
} | |
} | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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