2012-12-13 13:05:22 -08:00
|
|
|
|
// xfail-fast
|
|
|
|
|
|
2012-12-10 17:32:48 -08:00
|
|
|
|
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
|
//
|
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
|
// except according to those terms.
|
|
|
|
|
|
2013-07-29 12:51:55 -07:00
|
|
|
|
pub type Task = int;
|
|
|
|
|
|
2012-09-18 22:45:24 -07:00
|
|
|
|
// tjc: I don't know why
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub mod pipes {
|
2013-07-29 12:51:55 -07:00
|
|
|
|
use super::Task;
|
2013-05-20 17:07:24 -07:00
|
|
|
|
use std::cast::{forget, transmute};
|
2013-05-24 19:35:29 -07:00
|
|
|
|
use std::cast;
|
|
|
|
|
use std::task;
|
|
|
|
|
use std::util;
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-01-25 22:46:32 -08:00
|
|
|
|
pub struct Stuff<T> {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
state: state,
|
2013-07-29 12:51:55 -07:00
|
|
|
|
blocked_task: Option<Task>,
|
2013-02-22 16:08:16 -08:00
|
|
|
|
payload: Option<T>
|
2013-01-25 22:46:32 -08:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 11:42:59 -04:00
|
|
|
|
#[deriving(Eq)]
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub enum state {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
empty,
|
|
|
|
|
full,
|
|
|
|
|
blocked,
|
|
|
|
|
terminated
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-06 19:09:17 -08:00
|
|
|
|
pub struct packet<T> {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
state: state,
|
2013-07-29 12:51:55 -07:00
|
|
|
|
blocked_task: Option<Task>,
|
2013-02-22 16:08:16 -08:00
|
|
|
|
payload: Option<T>
|
2013-03-06 19:09:17 -08:00
|
|
|
|
}
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn packet<T:Send>() -> *packet<T> {
|
2013-01-23 11:43:58 -08:00
|
|
|
|
unsafe {
|
2013-01-25 22:46:32 -08:00
|
|
|
|
let p: *packet<T> = cast::transmute(~Stuff{
|
2013-02-22 16:08:16 -08:00
|
|
|
|
state: empty,
|
2013-07-29 12:51:55 -07:00
|
|
|
|
blocked_task: None::<Task>,
|
2013-02-22 16:08:16 -08:00
|
|
|
|
payload: None::<T>
|
2013-01-23 11:43:58 -08:00
|
|
|
|
});
|
|
|
|
|
p
|
|
|
|
|
}
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mod rusti {
|
2013-09-29 19:23:57 -07:00
|
|
|
|
pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { fail2!(); }
|
|
|
|
|
pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { fail2!(); }
|
|
|
|
|
pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { fail2!(); }
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-20 17:07:24 -07:00
|
|
|
|
// We should consider moving this to ::std::unsafe, although I
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// suspect graydon would want us to use void pointers instead.
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub unsafe fn uniquify<T>(x: *T) -> ~T {
|
2013-08-17 08:37:42 -07:00
|
|
|
|
cast::transmute(x)
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn swap_state_acq(dst: &mut state, src: state) -> state {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
unsafe {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
transmute(rusti::atomic_xchg_acq(transmute(dst), src as int))
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn swap_state_rel(dst: &mut state, src: state) -> state {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
unsafe {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
transmute(rusti::atomic_xchg_rel(transmute(dst), src as int))
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn send<T:Send>(mut p: send_packet<T>, payload: T) {
|
2013-08-17 08:37:42 -07:00
|
|
|
|
let p = p.unwrap();
|
2013-02-22 16:08:16 -08:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2013-03-28 18:39:09 -07:00
|
|
|
|
assert!((*p).payload.is_none());
|
2013-02-15 02:44:18 -08:00
|
|
|
|
(*p).payload = Some(payload);
|
2012-08-23 17:19:35 -04:00
|
|
|
|
let old_state = swap_state_rel(&mut (*p).state, full);
|
2012-08-06 12:34:08 -07:00
|
|
|
|
match old_state {
|
2012-08-03 19:59:04 -07:00
|
|
|
|
empty => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// Yay, fastpath.
|
2012-06-25 12:21:01 -07:00
|
|
|
|
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// The receiver will eventually clean this up.
|
2013-02-15 02:44:18 -08:00
|
|
|
|
unsafe { forget(p); }
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2013-09-29 19:23:57 -07:00
|
|
|
|
full => { fail2!("duplicate send") }
|
2012-08-03 19:59:04 -07:00
|
|
|
|
blocked => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
|
|
|
|
// The receiver will eventually clean this up.
|
2013-02-15 02:44:18 -08:00
|
|
|
|
unsafe { forget(p); }
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
terminated => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// The receiver will never receive this. Rely on drop_glue
|
|
|
|
|
// to clean everything up.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn recv<T:Send>(mut p: recv_packet<T>) -> Option<T> {
|
2013-08-17 08:37:42 -07:00
|
|
|
|
let p = p.unwrap();
|
2013-02-22 16:08:16 -08:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-06-25 22:11:19 -07:00
|
|
|
|
loop {
|
2012-08-23 17:19:35 -04:00
|
|
|
|
let old_state = swap_state_acq(&mut (*p).state,
|
2012-06-25 22:11:19 -07:00
|
|
|
|
blocked);
|
2012-08-06 12:34:08 -07:00
|
|
|
|
match old_state {
|
2013-08-16 12:49:40 -07:00
|
|
|
|
empty | blocked => { task::deschedule(); }
|
2012-08-03 19:59:04 -07:00
|
|
|
|
full => {
|
2013-05-06 00:42:54 -04:00
|
|
|
|
let payload = util::replace(&mut p.payload, None);
|
2013-03-16 15:49:12 -04:00
|
|
|
|
return Some(payload.unwrap())
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
terminated => {
|
2013-05-18 22:02:45 -04:00
|
|
|
|
assert_eq!(old_state, terminated);
|
2012-08-20 12:23:37 -07:00
|
|
|
|
return None;
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-17 08:37:42 -07:00
|
|
|
|
pub fn sender_terminate<T:Send>(p: *packet<T>) {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-08-23 17:19:35 -04:00
|
|
|
|
match swap_state_rel(&mut (*p).state, terminated) {
|
2012-08-03 19:59:04 -07:00
|
|
|
|
empty | blocked => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// The receiver will eventually clean up.
|
2013-02-15 02:44:18 -08:00
|
|
|
|
unsafe { forget(p) }
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
full => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// This is impossible
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!("you dun goofed")
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
terminated => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// I have to clean up, use drop_glue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-08-17 08:37:42 -07:00
|
|
|
|
pub fn receiver_terminate<T:Send>(p: *packet<T>) {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-08-23 17:19:35 -04:00
|
|
|
|
match swap_state_rel(&mut (*p).state, terminated) {
|
2012-08-03 19:59:04 -07:00
|
|
|
|
empty => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// the sender will clean up
|
2013-02-15 02:44:18 -08:00
|
|
|
|
unsafe { forget(p) }
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
blocked => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// this shouldn't happen.
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!("terminating a blocked packet")
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
|
terminated | full => {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
// I have to clean up, use drop_glue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-28 10:46:43 -08:00
|
|
|
|
pub struct send_packet<T> {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
p: Option<*packet<T>>,
|
2012-11-14 01:22:37 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 18:18:57 -07:00
|
|
|
|
#[unsafe_destructor]
|
2013-06-05 17:56:24 -07:00
|
|
|
|
impl<T:Send> Drop for send_packet<T> {
|
2013-09-16 21:18:07 -04:00
|
|
|
|
fn drop(&mut self) {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
unsafe {
|
|
|
|
|
if self.p != None {
|
|
|
|
|
let self_p: &mut Option<*packet<T>> =
|
|
|
|
|
cast::transmute(&self.p);
|
2013-05-06 00:42:54 -04:00
|
|
|
|
let p = util::replace(self_p, None);
|
2013-03-16 15:49:12 -04:00
|
|
|
|
sender_terminate(p.unwrap())
|
2013-02-22 16:08:16 -08:00
|
|
|
|
}
|
2012-06-25 12:21:01 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-07 19:04:40 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
impl<T:Send> send_packet<T> {
|
2013-05-31 15:17:22 -07:00
|
|
|
|
pub fn unwrap(&mut self) -> *packet<T> {
|
2013-05-06 00:42:54 -04:00
|
|
|
|
util::replace(&mut self.p, None).unwrap()
|
2012-06-25 12:21:01 -07:00
|
|
|
|
}
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn send_packet<T:Send>(p: *packet<T>) -> send_packet<T> {
|
2012-09-05 15:58:43 -07:00
|
|
|
|
send_packet {
|
|
|
|
|
p: Some(p)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-28 10:46:43 -08:00
|
|
|
|
pub struct recv_packet<T> {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
p: Option<*packet<T>>,
|
2012-11-14 01:22:37 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 18:18:57 -07:00
|
|
|
|
#[unsafe_destructor]
|
2013-06-05 17:56:24 -07:00
|
|
|
|
impl<T:Send> Drop for recv_packet<T> {
|
2013-09-16 21:18:07 -04:00
|
|
|
|
fn drop(&mut self) {
|
2013-02-22 16:08:16 -08:00
|
|
|
|
unsafe {
|
|
|
|
|
if self.p != None {
|
|
|
|
|
let self_p: &mut Option<*packet<T>> =
|
|
|
|
|
cast::transmute(&self.p);
|
2013-05-06 00:42:54 -04:00
|
|
|
|
let p = util::replace(self_p, None);
|
2013-03-16 15:49:12 -04:00
|
|
|
|
receiver_terminate(p.unwrap())
|
2013-02-22 16:08:16 -08:00
|
|
|
|
}
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-07 19:04:40 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
impl<T:Send> recv_packet<T> {
|
2013-05-31 15:17:22 -07:00
|
|
|
|
pub fn unwrap(&mut self) -> *packet<T> {
|
2013-05-06 00:42:54 -04:00
|
|
|
|
util::replace(&mut self.p, None).unwrap()
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn recv_packet<T:Send>(p: *packet<T>) -> recv_packet<T> {
|
2012-09-05 15:58:43 -07:00
|
|
|
|
recv_packet {
|
|
|
|
|
p: Some(p)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 17:56:24 -07:00
|
|
|
|
pub fn entangle<T:Send>() -> (send_packet<T>, recv_packet<T>) {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
let p = packet();
|
|
|
|
|
(send_packet(p), recv_packet(p))
|
|
|
|
|
}
|
2012-06-25 12:21:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub mod pingpong {
|
2013-05-20 17:07:24 -07:00
|
|
|
|
use std::cast;
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-03-07 16:36:30 -08:00
|
|
|
|
pub struct ping(::pipes::send_packet<pong>);
|
|
|
|
|
pub struct pong(::pipes::send_packet<ping>);
|
2012-12-28 17:17:05 -08:00
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
|
2013-01-23 11:43:58 -08:00
|
|
|
|
unsafe {
|
2013-08-17 08:37:42 -07:00
|
|
|
|
let _addr : *::pipes::send_packet<pong> = match &p {
|
2013-04-22 14:27:30 -07:00
|
|
|
|
&ping(ref x) => { cast::transmute(x) }
|
2013-01-23 11:43:58 -08:00
|
|
|
|
};
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!()
|
2013-01-23 11:43:58 -08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn liberate_pong(p: pong) -> ::pipes::send_packet<ping> {
|
2013-01-23 11:43:58 -08:00
|
|
|
|
unsafe {
|
2013-08-17 08:37:42 -07:00
|
|
|
|
let _addr : *::pipes::send_packet<ping> = match &p {
|
2013-04-22 14:27:30 -07:00
|
|
|
|
&pong(ref x) => { cast::transmute(x) }
|
2013-01-23 11:43:58 -08:00
|
|
|
|
};
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!()
|
2013-01-23 11:43:58 -08:00
|
|
|
|
}
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub fn init() -> (client::ping, server::ping) {
|
|
|
|
|
::pipes::entangle()
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub mod client {
|
|
|
|
|
use pingpong;
|
|
|
|
|
|
|
|
|
|
pub type ping = ::pipes::send_packet<pingpong::ping>;
|
|
|
|
|
pub type pong = ::pipes::recv_packet<pingpong::pong>;
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn do_ping(c: ping) -> pong {
|
2012-12-28 17:17:05 -08:00
|
|
|
|
let (sp, rp) = ::pipes::entangle();
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-02-15 02:44:18 -08:00
|
|
|
|
::pipes::send(c, pingpong::ping(sp));
|
|
|
|
|
rp
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn do_pong(c: pong) -> (ping, ()) {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let packet = ::pipes::recv(c);
|
2012-08-27 16:26:35 -07:00
|
|
|
|
if packet.is_none() {
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!("sender closed the connection")
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2013-03-16 15:49:12 -04:00
|
|
|
|
(pingpong::liberate_pong(packet.unwrap()), ())
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 17:17:05 -08:00
|
|
|
|
pub mod server {
|
|
|
|
|
use pingpong;
|
|
|
|
|
|
|
|
|
|
pub type ping = ::pipes::recv_packet<pingpong::ping>;
|
|
|
|
|
pub type pong = ::pipes::send_packet<pingpong::pong>;
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn do_ping(c: ping) -> (pong, ()) {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let packet = ::pipes::recv(c);
|
2012-08-27 16:26:35 -07:00
|
|
|
|
if packet.is_none() {
|
2013-09-29 19:23:57 -07:00
|
|
|
|
fail2!("sender closed the connection")
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2013-03-16 15:49:12 -04:00
|
|
|
|
(pingpong::liberate_ping(packet.unwrap()), ())
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
pub fn do_pong(c: pong) -> ping {
|
2012-12-28 17:17:05 -08:00
|
|
|
|
let (sp, rp) = ::pipes::entangle();
|
2013-02-15 02:44:18 -08:00
|
|
|
|
::pipes::send(c, pingpong::pong(sp));
|
|
|
|
|
rp
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-25 12:21:01 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
fn client(chan: pingpong::client::ping) {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let chan = pingpong::client::do_ping(chan);
|
2013-09-29 19:23:57 -07:00
|
|
|
|
error2!("Sent ping");
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let (_chan, _data) = pingpong::client::do_pong(chan);
|
2013-09-29 19:23:57 -07:00
|
|
|
|
error2!("Received pong");
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 21:33:31 -07:00
|
|
|
|
fn server(chan: pingpong::server::ping) {
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let (chan, _data) = pingpong::server::do_ping(chan);
|
2013-09-29 19:23:57 -07:00
|
|
|
|
error2!("Received ping");
|
2013-02-15 02:44:18 -08:00
|
|
|
|
let _chan = pingpong::server::do_pong(chan);
|
2013-09-29 19:23:57 -07:00
|
|
|
|
error2!("Sent pong");
|
2012-06-25 22:11:19 -07:00
|
|
|
|
}
|
2012-06-25 12:21:01 -07:00
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
|
pub fn main() {
|
2012-06-25 22:11:19 -07:00
|
|
|
|
/*
|
|
|
|
|
// Commented out because of option::get error
|
|
|
|
|
|
|
|
|
|
let (client_, server_) = pingpong::init();
|
2013-06-04 12:03:58 +02:00
|
|
|
|
let client_ = Cell::new(client_);
|
|
|
|
|
let server_ = Cell::new(server_);
|
2012-06-25 22:11:19 -07:00
|
|
|
|
|
2013-02-15 02:44:18 -08:00
|
|
|
|
task::spawn {|client_|
|
2013-02-25 14:04:32 -08:00
|
|
|
|
let client__ = client_.take();
|
|
|
|
|
client(client__);
|
2012-06-25 22:11:19 -07:00
|
|
|
|
};
|
2013-02-15 02:44:18 -08:00
|
|
|
|
task::spawn {|server_|
|
2013-02-25 14:04:32 -08:00
|
|
|
|
let server__ = server_.take();
|
|
|
|
|
server(server_ˊ);
|
2012-06-25 22:11:19 -07:00
|
|
|
|
};
|
|
|
|
|
*/
|
2012-06-25 12:21:01 -07:00
|
|
|
|
}
|