2011-03-25 19:19:20 +00:00
|
|
|
// xfail-stage0
|
2010-06-24 04:03:09 +00:00
|
|
|
// This checks that preemption works.
|
|
|
|
|
2010-11-02 18:11:58 +00:00
|
|
|
impure fn starve_main(chan[int] alive) {
|
2010-06-24 04:03:09 +00:00
|
|
|
log "signalling main";
|
|
|
|
alive <| 1;
|
|
|
|
log "starving main";
|
|
|
|
let int i = 0;
|
|
|
|
while (true) {
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-11-02 18:11:58 +00:00
|
|
|
impure fn main() {
|
2010-06-24 04:03:09 +00:00
|
|
|
let port[int] alive = port();
|
|
|
|
log "main started";
|
|
|
|
let task s = spawn starve_main(chan(alive));
|
|
|
|
let int i;
|
|
|
|
log "main waiting for alive signal";
|
|
|
|
i <- alive;
|
|
|
|
log "main got alive signal";
|
2010-07-22 22:05:35 +00:00
|
|
|
while (i < 50) {
|
2010-06-24 04:03:09 +00:00
|
|
|
log "main iterated";
|
|
|
|
i += 1;
|
|
|
|
}
|
|
|
|
log "main completed";
|
|
|
|
}
|