src/test/04-Stress/9001_sporks.ck
raw| 1 | // 9001_sporks.ck |
| 2 | // thanks to Michael Heuer <[email protected]> for providing this example code |
| 3 | |
| 4 | fun void blink() { |
| 5 | while (true) { |
| 6 | 1::samp => now; |
| 7 | } |
| 8 | } |
| 9 | |
| 10 | Shred shred; |
| 11 | spork ~ blink() @=> shred; |
| 12 | |
| 13 | 0 => int count; |
| 14 | |
| 15 | while (count <= 9001) { |
| 16 | 1::samp => now; |
| 17 | shred.id() => Machine.remove; |
| 18 | spork ~ blink() @=> shred; |
| 19 | |
| 20 | 1 +=> count; |
| 21 | } |
| 22 | |
| 23 | <<< "success" >>>; |