summary refs log tree commit diff
path: root/src/test/run-pass/yield.rs
blob: f9c2ad2547d66ef5454ad66cb4587cca5717aedb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// -*- rust -*-
extern mod std;
use task::*;

fn main() {
    let mut result = None;
    task::task().future_result(|+r| { result = Some(r); }).spawn(child);
    error!("1");
    yield();
    error!("2");
    yield();
    error!("3");
    future::get(&option::unwrap(result));
}

fn child() {
    error!("4"); yield(); error!("5"); yield(); error!("6");
}