Debian Codegraph @

src/test/05-Global/41.ck

raw
1 // 41.ck : event
2
3 // declare an event
4 global Event e;
5
6 // declare function
7 fun void hi( Event e )
8 {
9 // wait on event e
10 e => now;
11
12 // this only happens AFTER e is signaled
13 <<<"success">>>;
14 }
15
16 // spork shred with e
17 spork ~ hi( e );
18
19 // allow time to pass to give the shred a chance to run
20 1::ms => now;
21
22 // signal e
23 e.signal();
24
25 // advance time to let the other shred run
26 // (the parent shred will free the child shred)
27 1::samp => now;