rust/src/test/run-pass/spawn-fn.rs

19 lines
411 B
Rust
Raw Normal View History

2010-06-23 23:03:09 -05:00
// -*- rust -*-
use std;
import std::task::yield;
import std::task;
2011-10-20 22:34:04 -05:00
fn x(&&args: (str, int)) {
let (s, n) = args;
log s; log n;
}
2010-06-23 23:03:09 -05:00
fn main() {
task::spawn(("hello from first spawned fn", 65), x);
task::spawn(("hello from second spawned fn", 66), x);
task::spawn(("hello from third spawned fn", 67), x);
2011-07-27 07:19:39 -05:00
let i: int = 30;
while i > 0 { i = i - 1; log "parent sleeping"; yield(); }
}