changed all the impl<T> to impl<T: Send> in rt::comm.rs and libstd::comm.rs #8180

This commit is contained in:
reedlepee 2013-10-30 06:40:40 +05:30
parent b5e073830b
commit d10106e919
2 changed files with 23 additions and 23 deletions

View File

@ -188,7 +188,7 @@ fn try_send_deferred(&self, val: T) -> bool {
}
}
impl<T> Clone for SharedChan<T> {
impl<T: Send> Clone for SharedChan<T> {
fn clone(&self) -> SharedChan<T> {
let &SharedChan { x: ref c } = self;
SharedChan { x: c.clone() }
@ -216,7 +216,7 @@ fn try_recv(&self) -> Option<T> {
}
}
impl<T> Clone for SharedPort<T> {
impl<T: Send> Clone for SharedPort<T> {
fn clone(&self) -> SharedPort<T> {
let &SharedPort { x: ref p } = self;
SharedPort { x: p.clone() }

View File

@ -78,7 +78,7 @@ pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
}
}
impl<T> ChanOne<T> {
impl<T: Send> ChanOne<T> {
#[inline]
fn packet(&self) -> *mut Packet<T> {
unsafe {
@ -181,7 +181,7 @@ fn try_send_inner(mut self, val: T, do_resched: bool) -> bool {
}
}
impl<T> PortOne<T> {
impl<T: Send> PortOne<T> {
fn packet(&self) -> *mut Packet<T> {
unsafe {
let p: *mut ~Packet<T> = cast::transmute(&self.void_packet);
@ -218,7 +218,7 @@ pub fn try_recv(mut self) -> Option<T> {
}
}
impl<T> SelectInner for PortOne<T> {
impl<T: Send> SelectInner for PortOne<T> {
#[inline] #[cfg(not(test))]
fn optimistic_check(&mut self) -> bool {
unsafe { (*self.packet()).state.load(Acquire) == STATE_ONE }
@ -319,9 +319,9 @@ fn unblock_from(&mut self) -> bool {
}
}
impl<T> Select for PortOne<T> { }
impl<T: Send> Select for PortOne<T> { }
impl<T> SelectPortInner<T> for PortOne<T> {
impl<T: Send> SelectPortInner<T> for PortOne<T> {
fn recv_ready(mut self) -> Option<T> {
let packet = self.packet();
@ -352,9 +352,9 @@ fn recv_ready(mut self) -> Option<T> {
}
}
impl<T> SelectPort<T> for PortOne<T> { }
impl<T: Send> SelectPort<T> for PortOne<T> { }
impl<T> Peekable<T> for PortOne<T> {
impl<T: Send> Peekable<T> for PortOne<T> {
fn peek(&self) -> bool {
unsafe {
let packet: *mut Packet<T> = self.packet();
@ -369,7 +369,7 @@ fn peek(&self) -> bool {
}
#[unsafe_destructor]
impl<T> Drop for ChanOne<T> {
impl<T: Send> Drop for ChanOne<T> {
fn drop(&mut self) {
if self.suppress_finalize { return }
@ -396,7 +396,7 @@ fn drop(&mut self) {
}
#[unsafe_destructor]
impl<T> Drop for PortOne<T> {
impl<T: Send> Drop for PortOne<T> {
fn drop(&mut self) {
if self.suppress_finalize { return }
@ -484,7 +484,7 @@ fn try_send_deferred(&self, val: T) -> bool {
}
}
impl<T> GenericPort<T> for Port<T> {
impl<T: Send> GenericPort<T> for Port<T> {
fn recv(&self) -> T {
match self.try_recv() {
Some(val) => val,
@ -507,7 +507,7 @@ fn try_recv(&self) -> Option<T> {
}
}
impl<T> Peekable<T> for Port<T> {
impl<T: Send> Peekable<T> for Port<T> {
fn peek(&self) -> bool {
self.next.with_mut_ref(|p| p.peek())
}
@ -517,7 +517,7 @@ fn peek(&self) -> bool {
// of them, but a &Port<T> should also be selectable so you can select2 on it
// alongside a PortOne<U> without passing the port by value in recv_ready.
impl<'self, T> SelectInner for &'self Port<T> {
impl<'self, T: Send> SelectInner for &'self Port<T> {
#[inline]
fn optimistic_check(&mut self) -> bool {
do self.next.with_mut_ref |pone| { pone.optimistic_check() }
@ -535,9 +535,9 @@ fn unblock_from(&mut self) -> bool {
}
}
impl<'self, T> Select for &'self Port<T> { }
impl<'self, T: Send> Select for &'self Port<T> { }
impl<T> SelectInner for Port<T> {
impl<T: Send> SelectInner for Port<T> {
#[inline]
fn optimistic_check(&mut self) -> bool {
(&*self).optimistic_check()
@ -554,9 +554,9 @@ fn unblock_from(&mut self) -> bool {
}
}
impl<T> Select for Port<T> { }
impl<T: Send> Select for Port<T> { }
impl<'self, T> SelectPortInner<T> for &'self Port<T> {
impl<'self, T: Send> SelectPortInner<T> for &'self Port<T> {
fn recv_ready(self) -> Option<T> {
match self.next.take().recv_ready() {
Some(StreamPayload { val, next }) => {
@ -568,14 +568,14 @@ fn recv_ready(self) -> Option<T> {
}
}
impl<'self, T> SelectPort<T> for &'self Port<T> { }
impl<'self, T: Send> SelectPort<T> for &'self Port<T> { }
pub struct SharedChan<T> {
// Just like Chan, but a shared AtomicOption instead of Cell
priv next: UnsafeArc<AtomicOption<StreamChanOne<T>>>
}
impl<T> SharedChan<T> {
impl<T: Send> SharedChan<T> {
pub fn new(chan: Chan<T>) -> SharedChan<T> {
let next = chan.next.take();
let next = AtomicOption::new(~next);
@ -615,7 +615,7 @@ fn try_send_deferred(&self, val: T) -> bool {
}
}
impl<T> Clone for SharedChan<T> {
impl<T: Send> Clone for SharedChan<T> {
fn clone(&self) -> SharedChan<T> {
SharedChan {
next: self.next.clone()
@ -628,7 +628,7 @@ pub struct SharedPort<T> {
priv next_link: UnsafeArc<AtomicOption<PortOne<StreamPortOne<T>>>>
}
impl<T> SharedPort<T> {
impl<T: Send> SharedPort<T> {
pub fn new(port: Port<T>) -> SharedPort<T> {
// Put the data port into a new link pipe
let next_data_port = port.next.take();
@ -670,7 +670,7 @@ fn try_recv(&self) -> Option<T> {
}
}
impl<T> Clone for SharedPort<T> {
impl<T: Send> Clone for SharedPort<T> {
fn clone(&self) -> SharedPort<T> {
SharedPort {
next_link: self.next_link.clone()