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

19 lines
410 B
Rust
Raw Normal View History

2010-06-23 21:03:09 -07:00
// -*- rust -*-
use std;
import task::yield;
import task;
2012-01-04 21:14:53 -08:00
fn x(s: str, n: int) {
log(debug, s);
log(debug, n);
}
2010-06-23 21:03:09 -07:00
fn main() {
2012-01-04 21:14:53 -08:00
task::spawn {|| x("hello from first spawned fn", 65); };
task::spawn {|| x("hello from second spawned fn", 66); };
task::spawn {|| x("hello from third spawned fn", 67); };
2011-07-27 14:19:39 +02:00
let i: int = 30;
while i > 0 { i = i - 1; #debug("parent sleeping"); yield(); }
}