rust/src/test/run-pass/preempt.rs
Brian Anderson c53402846e Remove all xfail-stage0 directives
While it is still technically possible to test stage 0, it is not part of any
of the main testing rules and maintaining xfail-stage0 is a chore. Nobody
should worry about how tests fare in stage0.
2011-08-03 10:55:59 -07:00

24 lines
544 B
Rust

// xfail-stage1
// xfail-stage2
// xfail-stage3
// This checks that preemption works.
fn starve_main(alive: chan[int]) {
log "signalling main";
alive <| 1;
log "starving main";
let i: int = 0;
while true { i += 1; }
}
fn main() {
let alive: port[int] = port();
log "main started";
let s: task = spawn starve_main(chan(alive));
let i: int;
log "main waiting for alive signal";
alive |> i;
log "main got alive signal";
while i < 50 { log "main iterated"; i += 1; }
log "main completed";
}