diff options
Diffstat (limited to 'src/3rdparty/squirrel/samples/tailstate.nut')
-rw-r--r-- | src/3rdparty/squirrel/samples/tailstate.nut | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/3rdparty/squirrel/samples/tailstate.nut b/src/3rdparty/squirrel/samples/tailstate.nut new file mode 100644 index 000000000..59fb962ef --- /dev/null +++ b/src/3rdparty/squirrel/samples/tailstate.nut @@ -0,0 +1,24 @@ +function state1() +{ + ::suspend("state1"); + return state2(); +} + +function state2() +{ + ::suspend("state2"); + return state3(); +} + +function state3() +{ + ::suspend("state3"); + return state1(); +} + +local statethread = ::newthread(state1) + +::print(statethread.call()+"\n"); + +for(local i = 0; i < 10000; i++) + ::print(statethread.wakeup()+"\n"); |