Skip to content

Instantly share code, notes, and snippets.

@brson
Created November 5, 2012 00:10
Show Gist options
  • Save brson/4014490 to your computer and use it in GitHub Desktop.
Save brson/4014490 to your computer and use it in GitHub Desktop.
use std::comm::DuplexStream;
enum PingPong { Ping, Pong };
fn main() {
let (channel1, channel2): (DuplexStream<PingPong, PingPong>, DuplexStream<PingPong, PingPong>) = DuplexStream();
spawn |move channel1| {
channel.send(Ping),
loop {
match channel.recv() {
}
spawn |move channel2| {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment