2011-08-05 20:43:33 -05:00
|
|
|
use std;
|
|
|
|
|
2011-12-13 18:25:51 -06:00
|
|
|
import comm;
|
|
|
|
import comm::chan;
|
|
|
|
import comm::send;
|
|
|
|
import task;
|
2011-08-05 20:43:33 -05:00
|
|
|
|
2011-07-27 07:19:39 -05:00
|
|
|
fn main() { test05(); }
|
2010-07-19 16:05:18 -05:00
|
|
|
|
2011-10-20 22:34:04 -05:00
|
|
|
fn test05_start(ch : chan<int>) {
|
2011-12-22 19:53:53 -06:00
|
|
|
log(error, ch);
|
2011-08-11 12:46:57 -05:00
|
|
|
send(ch, 10);
|
2011-12-22 16:42:52 -06:00
|
|
|
#error("sent 10");
|
2011-08-11 12:46:57 -05:00
|
|
|
send(ch, 20);
|
2011-12-22 16:42:52 -06:00
|
|
|
#error("sent 20");
|
2011-08-11 12:46:57 -05:00
|
|
|
send(ch, 30);
|
2011-12-22 16:42:52 -06:00
|
|
|
#error("sent 30");
|
2011-08-05 20:43:33 -05:00
|
|
|
}
|
2010-07-19 16:05:18 -05:00
|
|
|
|
2011-04-19 15:35:49 -05:00
|
|
|
fn test05() {
|
2011-09-16 13:29:40 -05:00
|
|
|
let po = comm::port();
|
|
|
|
let ch = comm::chan(po);
|
2012-06-26 15:55:56 -05:00
|
|
|
task::spawn({|| test05_start(ch); });
|
2012-03-22 10:39:41 -05:00
|
|
|
let mut value = comm::recv(po);
|
2011-12-22 19:53:53 -06:00
|
|
|
log(error, value);
|
2011-09-16 13:29:40 -05:00
|
|
|
value = comm::recv(po);
|
2011-12-22 19:53:53 -06:00
|
|
|
log(error, value);
|
2011-09-16 13:29:40 -05:00
|
|
|
value = comm::recv(po);
|
2011-12-22 19:53:53 -06:00
|
|
|
log(error, value);
|
2011-05-02 19:47:24 -05:00
|
|
|
assert (value == 30);
|
2011-08-06 12:07:39 -05:00
|
|
|
}
|