2010-08-09 06:53:37 -07:00
|
|
|
// -*- rust -*-
|
|
|
|
|
2011-08-13 15:20:11 -07:00
|
|
|
use std;
|
|
|
|
import std::comm::_chan;
|
|
|
|
import std::comm::mk_port;
|
|
|
|
import std::comm::send;
|
|
|
|
import std::task;
|
|
|
|
|
2011-08-10 09:27:22 -07:00
|
|
|
fn a(c: _chan<int>) { send(c, 10); }
|
2010-08-09 06:53:37 -07:00
|
|
|
|
2011-04-19 13:35:49 -07:00
|
|
|
fn main() {
|
2011-08-13 15:20:11 -07:00
|
|
|
let p = mk_port();
|
|
|
|
task::_spawn(bind a(p.mk_chan()));
|
|
|
|
task::_spawn(bind b(p.mk_chan()));
|
2011-07-27 14:19:39 +02:00
|
|
|
let n: int = 0;
|
2011-08-13 15:20:11 -07:00
|
|
|
n = p.recv();
|
|
|
|
n = p.recv();
|
2011-07-27 14:19:39 +02:00
|
|
|
// log "Finished.";
|
2010-08-09 06:53:37 -07:00
|
|
|
}
|
|
|
|
|
2011-08-10 09:27:22 -07:00
|
|
|
fn b(c: _chan<int>) {
|
2011-07-27 14:19:39 +02:00
|
|
|
// log "task b0";
|
|
|
|
// log "task b1";
|
|
|
|
// log "task b2";
|
|
|
|
// log "task b3";
|
|
|
|
// log "task b4";
|
|
|
|
// log "task b5";
|
2011-08-13 15:20:11 -07:00
|
|
|
send(c, 10);
|
2011-08-10 09:27:22 -07:00
|
|
|
}
|