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

16 lines
390 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-09-12 05:39:38 -05:00
fn x(-s: str, n: int) { log s; log n; }
2010-06-23 23:03:09 -05:00
fn main() {
2011-09-02 17:34:58 -05:00
task::spawn(bind x("hello from first spawned fn", 65));
task::spawn(bind x("hello from second spawned fn", 66));
task::spawn(bind x("hello from third spawned fn", 67));
2011-07-27 07:19:39 -05:00
let i: int = 30;
while i > 0 { i = i - 1; log "parent sleeping"; yield(); }
}