mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-17 02:54:26 +00:00
c53402846e
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.
24 lines
544 B
Rust
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";
|
|
} |