2011-07-27 07:48:34 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-08-12 20:34:19 -05:00
|
|
|
use std;
|
|
|
|
import std::task;
|
|
|
|
|
2011-07-27 07:48:34 -05:00
|
|
|
fn main() {
|
2011-08-12 20:34:19 -05:00
|
|
|
let i = 10;
|
2011-07-27 07:48:34 -05:00
|
|
|
while (i > 0) {
|
2011-08-12 20:34:19 -05:00
|
|
|
task::_spawn(bind child(i));
|
2011-07-27 07:48:34 -05:00
|
|
|
i = i - 1;
|
|
|
|
}
|
|
|
|
log "main thread exiting";
|
|
|
|
}
|
|
|
|
|
2011-08-12 20:34:19 -05:00
|
|
|
fn child(x : int) {
|
2011-07-27 07:48:34 -05:00
|
|
|
log x;
|
|
|
|
}
|
|
|
|
|