examples/shred/spork.ck
raw| 1 | // this shows how to dynamically spork shreds... |
| 2 | |
| 3 | fun void foo( int a ) |
| 4 | { |
| 5 | while( true ) |
| 6 | { |
| 7 | <<<a>>>; |
| 8 | 500::ms => now; |
| 9 | } |
| 10 | } |
| 11 | |
| 12 | spork ~ foo( 1 ); |
| 13 | 250::ms => now; |
| 14 | spork ~ foo( 2 ); |
| 15 | |
| 16 | |
| 17 | // infinite time loop - children shreds leave with parent shred |
| 18 | while( true ) |
| 19 | 1::second => now; |