rust/src/test/run-pass/task-comm-12.rs

20 lines
360 B
Rust
Raw Normal View History

use std;
import std::task;
2011-07-27 07:19:39 -05:00
fn main() { test00(); }
2011-07-27 07:19:39 -05:00
fn start(task_number: int) { log "Started / Finished task."; }
fn test00() {
2011-07-27 07:19:39 -05:00
let i: int = 0;
let t: task = spawn start(i);
// Sleep long enough for the task to finish.
task::sleep(10000u);
// Try joining tasks that have already finished.
task::join(t);
log "Joined task.";
}