src/test/01-Basic/210-mfun-invoke.ck
raw| 1 | // test calling chuck-side member functions from c++ |
| 2 | |
| 3 | // instance of our event |
| 4 | TheEvent e; |
| 5 | |
| 6 | // custom Event class |
| 7 | class TheEvent extends Event |
| 8 | { |
| 9 | // override the waiting_on() function, which is called by the VM |
| 10 | // when a shred has begun to wait on an Event |
| 11 | fun void waiting_on() |
| 12 | { |
| 13 | <<< "success" >>>; |
| 14 | e.broadcast(); |
| 15 | } |
| 16 | } |
| 17 | |
| 18 | // this shred will wait on event |
| 19 | e => now; |
| 20 |