rust/src/test/run-pass/yield.rs
2012-10-23 14:21:15 -07:00

18 lines
359 B
Rust

// -*- rust -*-
extern mod std;
use task::*;
fn main() {
let mut result = None;
task::task().future_result(|+r| { result = Some(move r); }).spawn(child);
error!("1");
yield();
error!("2");
yield();
error!("3");
option::unwrap(move result).recv();
}
fn child() {
error!("4"); yield(); error!("5"); yield(); error!("6");
}