@@ -78,7 +78,7 @@ pub fn oneshot<T: Send>() -> (PortOne<T>, ChanOne<T>) {
78
78
}
79
79
}
80
80
81
- impl < T > ChanOne < T > {
81
+ impl < T : Send > ChanOne < T > {
82
82
#[ inline]
83
83
fn packet ( & self ) -> * mut Packet < T > {
84
84
unsafe {
@@ -181,7 +181,7 @@ impl<T> ChanOne<T> {
181
181
}
182
182
}
183
183
184
- impl < T > PortOne < T > {
184
+ impl < T : Send > PortOne < T > {
185
185
fn packet ( & self ) -> * mut Packet < T > {
186
186
unsafe {
187
187
let p: * mut ~Packet < T > = cast:: transmute ( & self . void_packet ) ;
@@ -218,7 +218,7 @@ impl<T> PortOne<T> {
218
218
}
219
219
}
220
220
221
- impl < T > SelectInner for PortOne < T > {
221
+ impl < T : Send > SelectInner for PortOne < T > {
222
222
#[ inline] #[ cfg( not( test) ) ]
223
223
fn optimistic_check ( & mut self ) -> bool {
224
224
unsafe { ( * self . packet ( ) ) . state . load ( Acquire ) == STATE_ONE }
@@ -319,9 +319,9 @@ impl<T> SelectInner for PortOne<T> {
319
319
}
320
320
}
321
321
322
- impl < T > Select for PortOne < T > { }
322
+ impl < T : Send > Select for PortOne < T > { }
323
323
324
- impl < T > SelectPortInner < T > for PortOne < T > {
324
+ impl < T : Send > SelectPortInner < T > for PortOne < T > {
325
325
fn recv_ready ( mut self ) -> Option < T > {
326
326
let packet = self . packet ( ) ;
327
327
@@ -352,9 +352,9 @@ impl<T> SelectPortInner<T> for PortOne<T> {
352
352
}
353
353
}
354
354
355
- impl < T > SelectPort < T > for PortOne < T > { }
355
+ impl < T : Send > SelectPort < T > for PortOne < T > { }
356
356
357
- impl < T > Peekable < T > for PortOne < T > {
357
+ impl < T : Send > Peekable < T > for PortOne < T > {
358
358
fn peek ( & self ) -> bool {
359
359
unsafe {
360
360
let packet: * mut Packet < T > = self . packet ( ) ;
@@ -369,7 +369,7 @@ impl<T> Peekable<T> for PortOne<T> {
369
369
}
370
370
371
371
#[ unsafe_destructor]
372
- impl < T > Drop for ChanOne < T > {
372
+ impl < T : Send > Drop for ChanOne < T > {
373
373
fn drop ( & mut self ) {
374
374
if self . suppress_finalize { return }
375
375
@@ -396,7 +396,7 @@ impl<T> Drop for ChanOne<T> {
396
396
}
397
397
398
398
#[ unsafe_destructor]
399
- impl < T > Drop for PortOne < T > {
399
+ impl < T : Send > Drop for PortOne < T > {
400
400
fn drop ( & mut self ) {
401
401
if self . suppress_finalize { return }
402
402
@@ -484,7 +484,7 @@ impl<T: Send> SendDeferred<T> for Chan<T> {
484
484
}
485
485
}
486
486
487
- impl < T > GenericPort < T > for Port < T > {
487
+ impl < T : Send > GenericPort < T > for Port < T > {
488
488
fn recv ( & self ) -> T {
489
489
match self . try_recv ( ) {
490
490
Some ( val) => val,
@@ -507,7 +507,7 @@ impl<T> GenericPort<T> for Port<T> {
507
507
}
508
508
}
509
509
510
- impl < T > Peekable < T > for Port < T > {
510
+ impl < T : Send > Peekable < T > for Port < T > {
511
511
fn peek ( & self ) -> bool {
512
512
self . next . with_mut_ref ( |p| p. peek ( ) )
513
513
}
@@ -517,7 +517,7 @@ impl<T> Peekable<T> for Port<T> {
517
517
// of them, but a &Port<T> should also be selectable so you can select2 on it
518
518
// alongside a PortOne<U> without passing the port by value in recv_ready.
519
519
520
- impl < ' self , T > SelectInner for & ' self Port < T > {
520
+ impl < ' self , T : Send > SelectInner for & ' self Port < T > {
521
521
#[ inline]
522
522
fn optimistic_check ( & mut self ) -> bool {
523
523
do self . next . with_mut_ref |pone| { pone. optimistic_check ( ) }
@@ -535,9 +535,9 @@ impl<'self, T> SelectInner for &'self Port<T> {
535
535
}
536
536
}
537
537
538
- impl < ' self , T > Select for & ' self Port < T > { }
538
+ impl < ' self , T : Send > Select for & ' self Port < T > { }
539
539
540
- impl < T > SelectInner for Port < T > {
540
+ impl < T : Send > SelectInner for Port < T > {
541
541
#[ inline]
542
542
fn optimistic_check ( & mut self ) -> bool {
543
543
( & * self ) . optimistic_check ( )
@@ -554,9 +554,9 @@ impl<T> SelectInner for Port<T> {
554
554
}
555
555
}
556
556
557
- impl < T > Select for Port < T > { }
557
+ impl < T : Send > Select for Port < T > { }
558
558
559
- impl < ' self , T > SelectPortInner < T > for & ' self Port < T > {
559
+ impl < ' self , T : Send > SelectPortInner < T > for & ' self Port < T > {
560
560
fn recv_ready ( self ) -> Option < T > {
561
561
match self . next . take ( ) . recv_ready ( ) {
562
562
Some ( StreamPayload { val, next } ) => {
@@ -568,14 +568,14 @@ impl<'self, T> SelectPortInner<T> for &'self Port<T> {
568
568
}
569
569
}
570
570
571
- impl < ' self , T > SelectPort < T > for & ' self Port < T > { }
571
+ impl < ' self , T : Send > SelectPort < T > for & ' self Port < T > { }
572
572
573
573
pub struct SharedChan < T > {
574
574
// Just like Chan, but a shared AtomicOption instead of Cell
575
575
priv next : UnsafeArc < AtomicOption < StreamChanOne < T > > >
576
576
}
577
577
578
- impl < T > SharedChan < T > {
578
+ impl < T : Send > SharedChan < T > {
579
579
pub fn new ( chan : Chan < T > ) -> SharedChan < T > {
580
580
let next = chan. next . take ( ) ;
581
581
let next = AtomicOption :: new ( ~next) ;
@@ -615,7 +615,7 @@ impl<T: Send> SendDeferred<T> for SharedChan<T> {
615
615
}
616
616
}
617
617
618
- impl < T > Clone for SharedChan < T > {
618
+ impl < T : Send > Clone for SharedChan < T > {
619
619
fn clone ( & self ) -> SharedChan < T > {
620
620
SharedChan {
621
621
next : self . next . clone ( )
@@ -628,7 +628,7 @@ pub struct SharedPort<T> {
628
628
priv next_link : UnsafeArc < AtomicOption < PortOne < StreamPortOne < T > > > >
629
629
}
630
630
631
- impl < T > SharedPort < T > {
631
+ impl < T : Send > SharedPort < T > {
632
632
pub fn new ( port : Port < T > ) -> SharedPort < T > {
633
633
// Put the data port into a new link pipe
634
634
let next_data_port = port. next . take ( ) ;
@@ -670,7 +670,7 @@ impl<T: Send> GenericPort<T> for SharedPort<T> {
670
670
}
671
671
}
672
672
673
- impl < T > Clone for SharedPort < T > {
673
+ impl < T : Send > Clone for SharedPort < T > {
674
674
fn clone ( & self ) -> SharedPort < T > {
675
675
SharedPort {
676
676
next_link : self . next_link . clone ( )
0 commit comments