Debian Codegraph @

examples/shred/spork2-remove.ck

raw
1 // define function
2 fun void foo()
3 {
4 while( true )
5 {
6 <<< "hi" >>>;
7 .2::second => now;
8 }
9 }
10
11 // spork the function, remember the shred reference
12 spork ~ foo() @=> Shred @ s;
13
14 // wait for 2 seconds
15 2::second => now;
16
17 // remove by id; equivalent to s.exit()
18 Machine.remove( s.id() );
19
20 // wait a little more
21 2::second => now;