Skip to content

Instantly share code, notes, and snippets.

@brson
Created November 2, 2012 06:01
Show Gist options
  • Save brson/3998978 to your computer and use it in GitHub Desktop.
Save brson/3998978 to your computer and use it in GitHub Desktop.
extern mod std;
use core::pipes::*;
use std::comm::DuplexStream;
use core::task;
fn main () {
let (chan, port): (Chan<int>, Port<int>) = stream();
do task::spawn() |move port| {
assert port.recv() == 123;
assert !port.peek();
}
chan.send(123);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment