2010-08-24 23:06:56 -05:00
|
|
|
use std;
|
2011-12-13 18:25:51 -06:00
|
|
|
import task;
|
2010-08-24 23:06:56 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn main() { test00(); }
|
2010-08-24 23:06:56 -05:00
|
|
|
|
2011-12-22 16:42:52 -06:00
|
|
|
fn start(&&task_number: int) { #debug("Started / Finished task."); }
|
2011-07-13 17:44:09 -05:00
|
|
|
|
|
|
|
fn test00() {
|
2011-07-27 07:19:39 -05:00
|
|
|
let i: int = 0;
|
2011-10-13 23:23:07 -05:00
|
|
|
let t = task::spawn_joinable(i, start);
|
2011-07-13 17:44:09 -05:00
|
|
|
|
2010-08-24 23:06:56 -05:00
|
|
|
// Sleep long enough for the task to finish.
|
2011-07-12 17:27:17 -05:00
|
|
|
task::sleep(10000u);
|
2011-07-13 17:44:09 -05:00
|
|
|
|
2010-08-24 23:06:56 -05:00
|
|
|
// Try joining tasks that have already finished.
|
2011-08-25 13:20:43 -05:00
|
|
|
task::join(t);
|
2011-07-13 17:44:09 -05:00
|
|
|
|
2011-12-22 16:42:52 -06:00
|
|
|
#debug("Joined task.");
|
2011-08-06 12:07:39 -05:00
|
|
|
}
|