summaryrefslogtreecommitdiff
path: root/src/3rdparty/squirrel/samples/tailstate.nut
blob: 59fb962ef9594a194a5b5b0393408201ad0b4310 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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");