2012-12-13 15:05:22 -06:00
|
|
|
|
|
2014-02-07 13:08:32 -06:00
|
|
|
|
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
|
2012-12-10 19:32:48 -06:00
|
|
|
|
// 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.
|
2014-07-21 17:57:14 -05:00
|
|
|
|
//
|
|
|
|
|
// ignore-lexer-test FIXME #15883
|
2012-12-10 19:32:48 -06:00
|
|
|
|
|
2014-06-17 18:00:04 -05:00
|
|
|
|
#![feature(unsafe_destructor)]
|
|
|
|
|
|
2013-07-29 14:51:55 -05:00
|
|
|
|
pub type Task = int;
|
|
|
|
|
|
2012-09-19 00:45:24 -05:00
|
|
|
|
// tjc: I don't know why
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub mod pipes {
|
2014-11-06 02:05:53 -06:00
|
|
|
|
use self::state::{empty, full, blocked, terminated};
|
2013-07-29 14:51:55 -05:00
|
|
|
|
use super::Task;
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
use std::mem::{forget, transmute};
|
2014-01-31 14:35:36 -06:00
|
|
|
|
use std::mem::{replace, swap};
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
use std::mem;
|
2013-05-24 21:35:29 -05:00
|
|
|
|
use std::task;
|
2014-12-06 10:39:25 -06:00
|
|
|
|
use std::kinds::Send;
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2013-01-26 00:46:32 -06:00
|
|
|
|
pub struct Stuff<T> {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
state: state,
|
2013-07-29 14:51:55 -05:00
|
|
|
|
blocked_task: Option<Task>,
|
2013-02-22 18:08:16 -06:00
|
|
|
|
payload: Option<T>
|
2013-01-26 00:46:32 -06:00
|
|
|
|
}
|
|
|
|
|
|
2014-05-29 19:45:07 -05:00
|
|
|
|
#[deriving(PartialEq, Show)]
|
2013-09-25 11:41:10 -05:00
|
|
|
|
#[repr(int)]
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub enum state {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
empty,
|
|
|
|
|
full,
|
|
|
|
|
blocked,
|
|
|
|
|
terminated
|
|
|
|
|
}
|
|
|
|
|
|
2013-03-06 21:09:17 -06:00
|
|
|
|
pub struct packet<T> {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
state: state,
|
2013-07-29 14:51:55 -05:00
|
|
|
|
blocked_task: Option<Task>,
|
2013-02-22 18:08:16 -06:00
|
|
|
|
payload: Option<T>
|
2013-03-06 21:09:17 -06:00
|
|
|
|
}
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2014-12-06 10:39:25 -06:00
|
|
|
|
impl<T:Send> Send for packet<T> {}
|
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn packet<T:Send>() -> *const packet<T> {
|
2013-01-23 13:43:58 -06:00
|
|
|
|
unsafe {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
let p: *const packet<T> = mem::transmute(box Stuff{
|
2013-02-22 18:08:16 -06:00
|
|
|
|
state: empty,
|
2013-07-29 14:51:55 -05:00
|
|
|
|
blocked_task: None::<Task>,
|
2013-02-22 18:08:16 -06:00
|
|
|
|
payload: None::<T>
|
2013-01-23 13:43:58 -06:00
|
|
|
|
});
|
|
|
|
|
p
|
|
|
|
|
}
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mod rusti {
|
2014-10-09 14:17:22 -05:00
|
|
|
|
pub fn atomic_xchg(_dst: &mut int, _src: int) -> int { panic!(); }
|
|
|
|
|
pub fn atomic_xchg_acq(_dst: &mut int, _src: int) -> int { panic!(); }
|
|
|
|
|
pub fn atomic_xchg_rel(_dst: &mut int, _src: int) -> int { panic!(); }
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-20 19:07:24 -05:00
|
|
|
|
// We should consider moving this to ::std::unsafe, although I
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// suspect graydon would want us to use void pointers instead.
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub unsafe fn uniquify<T>(x: *const T) -> Box<T> {
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
mem::transmute(x)
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn swap_state_acq(dst: &mut state, src: state) -> state {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
unsafe {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
transmute(rusti::atomic_xchg_acq(transmute(dst), src as int))
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn swap_state_rel(dst: &mut state, src: state) -> state {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
unsafe {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
transmute(rusti::atomic_xchg_rel(transmute(dst), src as int))
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 19:56:24 -05:00
|
|
|
|
pub fn send<T:Send>(mut p: send_packet<T>, payload: T) {
|
2013-08-17 10:37:42 -05:00
|
|
|
|
let p = p.unwrap();
|
2013-02-22 18:08:16 -06:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2013-03-28 20:39:09 -05:00
|
|
|
|
assert!((*p).payload.is_none());
|
2013-02-15 04:44:18 -06:00
|
|
|
|
(*p).payload = Some(payload);
|
2012-08-23 16:19:35 -05:00
|
|
|
|
let old_state = swap_state_rel(&mut (*p).state, full);
|
2012-08-06 14:34:08 -05:00
|
|
|
|
match old_state {
|
2012-08-03 21:59:04 -05:00
|
|
|
|
empty => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// Yay, fastpath.
|
2012-06-25 14:21:01 -05:00
|
|
|
|
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// The receiver will eventually clean this up.
|
2013-02-15 04:44:18 -06:00
|
|
|
|
unsafe { forget(p); }
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2014-10-09 14:17:22 -05:00
|
|
|
|
full => { panic!("duplicate send") }
|
2012-08-03 21:59:04 -05:00
|
|
|
|
blocked => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
|
|
|
|
// The receiver will eventually clean this up.
|
2013-02-15 04:44:18 -06:00
|
|
|
|
unsafe { forget(p); }
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
terminated => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// The receiver will never receive this. Rely on drop_glue
|
|
|
|
|
// to clean everything up.
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 19:56:24 -05:00
|
|
|
|
pub fn recv<T:Send>(mut p: recv_packet<T>) -> Option<T> {
|
2013-08-17 10:37:42 -05:00
|
|
|
|
let p = p.unwrap();
|
2013-02-22 18:08:16 -06:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-06-26 00:11:19 -05:00
|
|
|
|
loop {
|
2012-08-23 16:19:35 -05:00
|
|
|
|
let old_state = swap_state_acq(&mut (*p).state,
|
2012-06-26 00:11:19 -05:00
|
|
|
|
blocked);
|
2012-08-06 14:34:08 -05:00
|
|
|
|
match old_state {
|
2013-08-16 14:49:40 -05:00
|
|
|
|
empty | blocked => { task::deschedule(); }
|
2012-08-03 21:59:04 -05:00
|
|
|
|
full => {
|
2014-01-31 14:35:36 -06:00
|
|
|
|
let payload = replace(&mut p.payload, None);
|
2013-03-16 14:49:12 -05:00
|
|
|
|
return Some(payload.unwrap())
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
terminated => {
|
2013-05-18 21:02:45 -05:00
|
|
|
|
assert_eq!(old_state, terminated);
|
2012-08-20 14:23:37 -05:00
|
|
|
|
return None;
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn sender_terminate<T:Send>(p: *const packet<T>) {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-08-23 16:19:35 -05:00
|
|
|
|
match swap_state_rel(&mut (*p).state, terminated) {
|
2012-08-03 21:59:04 -05:00
|
|
|
|
empty | blocked => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// The receiver will eventually clean up.
|
2013-02-15 04:44:18 -06:00
|
|
|
|
unsafe { forget(p) }
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
full => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// This is impossible
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!("you dun goofed")
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
terminated => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// I have to clean up, use drop_glue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn receiver_terminate<T:Send>(p: *const packet<T>) {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
let mut p = unsafe { uniquify(p) };
|
2012-08-23 16:19:35 -05:00
|
|
|
|
match swap_state_rel(&mut (*p).state, terminated) {
|
2012-08-03 21:59:04 -05:00
|
|
|
|
empty => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// the sender will clean up
|
2013-02-15 04:44:18 -06:00
|
|
|
|
unsafe { forget(p) }
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
blocked => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// this shouldn't happen.
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!("terminating a blocked packet")
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
|
terminated | full => {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
// I have to clean up, use drop_glue
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-28 12:46:43 -06:00
|
|
|
|
pub struct send_packet<T> {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
p: Option<*const packet<T>>,
|
2012-11-14 00:22:37 -06:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 20:18:57 -05:00
|
|
|
|
#[unsafe_destructor]
|
2013-06-05 19:56:24 -05:00
|
|
|
|
impl<T:Send> Drop for send_packet<T> {
|
2013-09-16 20:18:07 -05:00
|
|
|
|
fn drop(&mut self) {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
unsafe {
|
|
|
|
|
if self.p != None {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
let self_p: &mut Option<*const packet<T>> =
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
mem::transmute(&self.p);
|
2014-01-31 14:35:36 -06:00
|
|
|
|
let p = replace(self_p, None);
|
2013-03-16 14:49:12 -05:00
|
|
|
|
sender_terminate(p.unwrap())
|
2013-02-22 18:08:16 -06:00
|
|
|
|
}
|
2012-06-25 14:21:01 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-07 21:04:40 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 19:56:24 -05:00
|
|
|
|
impl<T:Send> send_packet<T> {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn unwrap(&mut self) -> *const packet<T> {
|
2014-01-31 14:35:36 -06:00
|
|
|
|
replace(&mut self.p, None).unwrap()
|
2012-06-25 14:21:01 -05:00
|
|
|
|
}
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn send_packet<T:Send>(p: *const packet<T>) -> send_packet<T> {
|
2012-09-05 17:58:43 -05:00
|
|
|
|
send_packet {
|
|
|
|
|
p: Some(p)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-28 12:46:43 -06:00
|
|
|
|
pub struct recv_packet<T> {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
p: Option<*const packet<T>>,
|
2012-11-14 00:22:37 -06:00
|
|
|
|
}
|
|
|
|
|
|
2013-03-20 20:18:57 -05:00
|
|
|
|
#[unsafe_destructor]
|
2013-06-05 19:56:24 -05:00
|
|
|
|
impl<T:Send> Drop for recv_packet<T> {
|
2013-09-16 20:18:07 -05:00
|
|
|
|
fn drop(&mut self) {
|
2013-02-22 18:08:16 -06:00
|
|
|
|
unsafe {
|
|
|
|
|
if self.p != None {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
let self_p: &mut Option<*const packet<T>> =
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
mem::transmute(&self.p);
|
2014-01-31 14:35:36 -06:00
|
|
|
|
let p = replace(self_p, None);
|
2013-03-16 14:49:12 -05:00
|
|
|
|
receiver_terminate(p.unwrap())
|
2013-02-22 18:08:16 -06:00
|
|
|
|
}
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-09-07 21:04:40 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 19:56:24 -05:00
|
|
|
|
impl<T:Send> recv_packet<T> {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn unwrap(&mut self) -> *const packet<T> {
|
2014-01-31 14:35:36 -06:00
|
|
|
|
replace(&mut self.p, None).unwrap()
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-25 14:47:34 -05:00
|
|
|
|
pub fn recv_packet<T:Send>(p: *const packet<T>) -> recv_packet<T> {
|
2012-09-05 17:58:43 -05:00
|
|
|
|
recv_packet {
|
|
|
|
|
p: Some(p)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-05 19:56:24 -05:00
|
|
|
|
pub fn entangle<T:Send>() -> (send_packet<T>, recv_packet<T>) {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
let p = packet();
|
|
|
|
|
(send_packet(p), recv_packet(p))
|
|
|
|
|
}
|
2012-06-25 14:21:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub mod pingpong {
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
use std::mem;
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2013-03-07 18:36:30 -06:00
|
|
|
|
pub struct ping(::pipes::send_packet<pong>);
|
2014-12-06 10:39:25 -06:00
|
|
|
|
|
|
|
|
|
unsafe impl Send for ping {}
|
|
|
|
|
|
2013-03-07 18:36:30 -06:00
|
|
|
|
pub struct pong(::pipes::send_packet<ping>);
|
2012-12-28 19:17:05 -06:00
|
|
|
|
|
2014-12-06 10:39:25 -06:00
|
|
|
|
unsafe impl Send for pong {}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn liberate_ping(p: ping) -> ::pipes::send_packet<pong> {
|
2013-01-23 13:43:58 -06:00
|
|
|
|
unsafe {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
let _addr : *const ::pipes::send_packet<pong> = match &p {
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
&ping(ref x) => { mem::transmute(x) }
|
2013-01-23 13:43:58 -06:00
|
|
|
|
};
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!()
|
2013-01-23 13:43:58 -06:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn liberate_pong(p: pong) -> ::pipes::send_packet<ping> {
|
2013-01-23 13:43:58 -06:00
|
|
|
|
unsafe {
|
2014-06-25 14:47:34 -05:00
|
|
|
|
let _addr : *const ::pipes::send_packet<ping> = match &p {
|
core: Remove the cast module
This commit revisits the `cast` module in libcore and libstd, and scrutinizes
all functions inside of it. The result was to remove the `cast` module entirely,
folding all functionality into the `mem` module. Specifically, this is the fate
of each function in the `cast` module.
* transmute - This function was moved to `mem`, but it is now marked as
#[unstable]. This is due to planned changes to the `transmute`
function and how it can be invoked (see the #[unstable] comment).
For more information, see RFC 5 and #12898
* transmute_copy - This function was moved to `mem`, with clarification that is
is not an error to invoke it with T/U that are different
sizes, but rather that it is strongly discouraged. This
function is now #[stable]
* forget - This function was moved to `mem` and marked #[stable]
* bump_box_refcount - This function was removed due to the deprecation of
managed boxes as well as its questionable utility.
* transmute_mut - This function was previously deprecated, and removed as part
of this commit.
* transmute_mut_unsafe - This function doesn't serve much of a purpose when it
can be achieved with an `as` in safe code, so it was
removed.
* transmute_lifetime - This function was removed because it is likely a strong
indication that code is incorrect in the first place.
* transmute_mut_lifetime - This function was removed for the same reasons as
`transmute_lifetime`
* copy_lifetime - This function was moved to `mem`, but it is marked
`#[unstable]` now due to the likelihood of being removed in
the future if it is found to not be very useful.
* copy_mut_lifetime - This function was also moved to `mem`, but had the same
treatment as `copy_lifetime`.
* copy_lifetime_vec - This function was removed because it is not used today,
and its existence is not necessary with DST
(copy_lifetime will suffice).
In summary, the cast module was stripped down to these functions, and then the
functions were moved to the `mem` module.
transmute - #[unstable]
transmute_copy - #[stable]
forget - #[stable]
copy_lifetime - #[unstable]
copy_mut_lifetime - #[unstable]
[breaking-change]
2014-05-09 12:34:51 -05:00
|
|
|
|
&pong(ref x) => { mem::transmute(x) }
|
2013-01-23 13:43:58 -06:00
|
|
|
|
};
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!()
|
2013-01-23 13:43:58 -06:00
|
|
|
|
}
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub fn init() -> (client::ping, server::ping) {
|
|
|
|
|
::pipes::entangle()
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub mod client {
|
|
|
|
|
use pingpong;
|
|
|
|
|
|
|
|
|
|
pub type ping = ::pipes::send_packet<pingpong::ping>;
|
|
|
|
|
pub type pong = ::pipes::recv_packet<pingpong::pong>;
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn do_ping(c: ping) -> pong {
|
2012-12-28 19:17:05 -06:00
|
|
|
|
let (sp, rp) = ::pipes::entangle();
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2013-02-15 04:44:18 -06:00
|
|
|
|
::pipes::send(c, pingpong::ping(sp));
|
|
|
|
|
rp
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn do_pong(c: pong) -> (ping, ()) {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let packet = ::pipes::recv(c);
|
2012-08-27 18:26:35 -05:00
|
|
|
|
if packet.is_none() {
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!("sender closed the connection")
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2013-03-16 14:49:12 -05:00
|
|
|
|
(pingpong::liberate_pong(packet.unwrap()), ())
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-28 19:17:05 -06:00
|
|
|
|
pub mod server {
|
|
|
|
|
use pingpong;
|
|
|
|
|
|
|
|
|
|
pub type ping = ::pipes::recv_packet<pingpong::ping>;
|
|
|
|
|
pub type pong = ::pipes::send_packet<pingpong::pong>;
|
2012-06-26 00:11:19 -05:00
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn do_ping(c: ping) -> (pong, ()) {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let packet = ::pipes::recv(c);
|
2012-08-27 18:26:35 -05:00
|
|
|
|
if packet.is_none() {
|
2014-10-09 14:17:22 -05:00
|
|
|
|
panic!("sender closed the connection")
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2013-03-16 14:49:12 -05:00
|
|
|
|
(pingpong::liberate_ping(packet.unwrap()), ())
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
pub fn do_pong(c: pong) -> ping {
|
2012-12-28 19:17:05 -06:00
|
|
|
|
let (sp, rp) = ::pipes::entangle();
|
2013-02-15 04:44:18 -06:00
|
|
|
|
::pipes::send(c, pingpong::pong(sp));
|
|
|
|
|
rp
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
}
|
2012-06-25 14:21:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
fn client(chan: pingpong::client::ping) {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let chan = pingpong::client::do_ping(chan);
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
|
println!("Sent ping");
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let (_chan, _data) = pingpong::client::do_pong(chan);
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
|
println!("Received pong");
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
|
|
|
|
|
2013-05-07 23:33:31 -05:00
|
|
|
|
fn server(chan: pingpong::server::ping) {
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let (chan, _data) = pingpong::server::do_ping(chan);
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
|
println!("Received ping");
|
2013-02-15 04:44:18 -06:00
|
|
|
|
let _chan = pingpong::server::do_pong(chan);
|
log: Introduce liblog, the old std::logging
This commit moves all logging out of the standard library into an external
crate. This crate is the new crate which is responsible for all logging macros
and logging implementation. A few reasons for this change are:
* The crate map has always been a bit of a code smell among rust programs. It
has difficulty being loaded on almost all platforms, and it's used almost
exclusively for logging and only logging. Removing the crate map is one of the
end goals of this movement.
* The compiler has a fair bit of special support for logging. It has the
__log_level() expression as well as generating a global word per module
specifying the log level. This is unfairly favoring the built-in logging
system, and is much better done purely in libraries instead of the compiler
itself.
* Initialization of logging is much easier to do if there is no reliance on a
magical crate map being available to set module log levels.
* If the logging library can be written outside of the standard library, there's
no reason that it shouldn't be. It's likely that we're not going to build the
highest quality logging library of all time, so third-party libraries should
be able to provide just as high-quality logging systems as the default one
provided in the rust distribution.
With a migration such as this, the change does not come for free. There are some
subtle changes in the behavior of liblog vs the previous logging macros:
* The core change of this migration is that there is no longer a physical
log-level per module. This concept is still emulated (it is quite useful), but
there is now only a global log level, not a local one. This global log level
is a reflection of the maximum of all log levels specified. The previously
generated logging code looked like:
if specified_level <= __module_log_level() {
println!(...)
}
The newly generated code looks like:
if specified_level <= ::log::LOG_LEVEL {
if ::log::module_enabled(module_path!()) {
println!(...)
}
}
Notably, the first layer of checking is still intended to be "super fast" in
that it's just a load of a global word and a compare. The second layer of
checking is executed to determine if the current module does indeed have
logging turned on.
This means that if any module has a debug log level turned on, all modules
with debug log levels get a little bit slower (they all do more expensive
dynamic checks to determine if they're turned on or not).
Semantically, this migration brings no change in this respect, but
runtime-wise, this will have a perf impact on some code.
* A `RUST_LOG=::help` directive will no longer print out a list of all modules
that can be logged. This is because the crate map will no longer specify the
log levels of all modules, so the list of modules is not known. Additionally,
warnings can no longer be provided if a malformed logging directive was
supplied.
The new "hello world" for logging looks like:
#[phase(syntax, link)]
extern crate log;
fn main() {
debug!("Hello, world!");
}
2014-03-09 00:11:44 -06:00
|
|
|
|
println!("Sent pong");
|
2012-06-26 00:11:19 -05:00
|
|
|
|
}
|
2012-06-25 14:21:01 -05:00
|
|
|
|
|
2013-02-01 21:43:17 -06:00
|
|
|
|
pub fn main() {
|
2012-06-26 00:11:19 -05:00
|
|
|
|
/*
|
|
|
|
|
// Commented out because of option::get error
|
|
|
|
|
|
|
|
|
|
let (client_, server_) = pingpong::init();
|
|
|
|
|
|
2013-02-15 04:44:18 -06:00
|
|
|
|
task::spawn {|client_|
|
2013-02-25 16:04:32 -06:00
|
|
|
|
let client__ = client_.take();
|
|
|
|
|
client(client__);
|
2012-06-26 00:11:19 -05:00
|
|
|
|
};
|
2013-02-15 04:44:18 -06:00
|
|
|
|
task::spawn {|server_|
|
2013-02-25 16:04:32 -06:00
|
|
|
|
let server__ = server_.take();
|
|
|
|
|
server(server_ˊ);
|
2012-06-26 00:11:19 -05:00
|
|
|
|
};
|
|
|
|
|
*/
|
2012-06-25 14:21:01 -05:00
|
|
|
|
}
|