@@ -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
@@ -478,7 +478,7 @@ impl<T: Send> SendDeferred<T> for Chan<T> {
478
478
}
479
479
}
480
480
481
- impl < T > GenericPort < T > for Port < T > {
481
+ impl < T : Send > GenericPort < T > for Port < T > {
482
482
fn recv ( & self ) -> T {
483
483
match self . try_recv ( ) {
484
484
Some ( val) => val,
@@ -501,7 +501,7 @@ impl<T> GenericPort<T> for Port<T> {
501
501
}
502
502
}
503
503
504
- impl < T > Peekable < T > for Port < T > {
504
+ impl < T : Send > Peekable < T > for Port < T > {
505
505
fn peek ( & self ) -> bool {
506
506
self . next . with_mut_ref ( |p| p. peek ( ) )
507
507
}
@@ -511,7 +511,7 @@ impl<T> Peekable<T> for Port<T> {
511
511
// of them, but a &Port<T> should also be selectable so you can select2 on it
512
512
// alongside a PortOne<U> without passing the port by value in recv_ready.
513
513
514
- impl < ' self , T > SelectInner for & ' self Port < T > {
514
+ impl < ' self , T : Send > SelectInner for & ' self Port < T > {
515
515
#[ inline]
516
516
fn optimistic_check ( & mut self ) -> bool {
517
517
do self . next . with_mut_ref |pone| { pone. optimistic_check ( ) }
@@ -529,9 +529,9 @@ impl<'self, T> SelectInner for &'self Port<T> {
529
529
}
530
530
}
531
531
532
- impl < ' self , T > Select for & ' self Port < T > { }
532
+ impl < ' self , T : Send > Select for & ' self Port < T > { }
533
533
534
- impl < T > SelectInner for Port < T > {
534
+ impl < T : Send > SelectInner for Port < T > {
535
535
#[ inline]
536
536
fn optimistic_check ( & mut self ) -> bool {
537
537
( & * self ) . optimistic_check ( )
@@ -548,9 +548,9 @@ impl<T> SelectInner for Port<T> {
548
548
}
549
549
}
550
550
551
- impl < T > Select for Port < T > { }
551
+ impl < T : Send > Select for Port < T > { }
552
552
553
- impl < ' self , T > SelectPortInner < T > for & ' self Port < T > {
553
+ impl < ' self , T : Send > SelectPortInner < T > for & ' self Port < T > {
554
554
fn recv_ready ( self ) -> Option < T > {
555
555
match self . next . take ( ) . recv_ready ( ) {
556
556
Some ( StreamPayload { val, next } ) => {
@@ -562,14 +562,14 @@ impl<'self, T> SelectPortInner<T> for &'self Port<T> {
562
562
}
563
563
}
564
564
565
- impl < ' self , T > SelectPort < T > for & ' self Port < T > { }
565
+ impl < ' self , T : Send > SelectPort < T > for & ' self Port < T > { }
566
566
567
567
pub struct SharedChan < T > {
568
568
// Just like Chan, but a shared AtomicOption instead of Cell
569
569
priv next : UnsafeArc < AtomicOption < StreamChanOne < T > > >
570
570
}
571
571
572
- impl < T > SharedChan < T > {
572
+ impl < T : Send > SharedChan < T > {
573
573
pub fn new ( chan : Chan < T > ) -> SharedChan < T > {
574
574
let next = chan. next . take ( ) ;
575
575
let next = AtomicOption :: new ( ~next) ;
@@ -609,7 +609,7 @@ impl<T: Send> SendDeferred<T> for SharedChan<T> {
609
609
}
610
610
}
611
611
612
- impl < T > Clone for SharedChan < T > {
612
+ impl < T : Send > Clone for SharedChan < T > {
613
613
fn clone ( & self ) -> SharedChan < T > {
614
614
SharedChan {
615
615
next : self . next . clone ( )
@@ -622,7 +622,7 @@ pub struct SharedPort<T> {
622
622
priv next_link : UnsafeArc < AtomicOption < PortOne < StreamPortOne < T > > > >
623
623
}
624
624
625
- impl < T > SharedPort < T > {
625
+ impl < T : Send > SharedPort < T > {
626
626
pub fn new ( port : Port < T > ) -> SharedPort < T > {
627
627
// Put the data port into a new link pipe
628
628
let next_data_port = port. next . take ( ) ;
@@ -664,7 +664,7 @@ impl<T: Send> GenericPort<T> for SharedPort<T> {
664
664
}
665
665
}
666
666
667
- impl < T > Clone for SharedPort < T > {
667
+ impl < T : Send > Clone for SharedPort < T > {
668
668
fn clone ( & self ) -> SharedPort < T > {
669
669
SharedPort {
670
670
next_link : self . next_link . clone ( )
0 commit comments