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