@@ -496,7 +496,7 @@ impl Packet {
496496 match self . channels . fetch_sub ( 1 , SeqCst ) {
497497 1 => {
498498 match self . cnt . swap ( DISCONNECTED , SeqCst ) {
499- -1 => { self . wakeup ( false ) ; }
499+ -1 => { self . wakeup ( true ) ; }
500500 DISCONNECTED => { }
501501 n => { assert ! ( n >= 0 ) ; }
502502 }
@@ -537,9 +537,6 @@ impl<T: Send> Chan<T> {
537537 /// port.
538538 ///
539539 /// Rust channels are infinitely buffered so this method will never block.
540- /// This method may trigger a rescheduling, however, in order to wake up a
541- /// blocked receiver (if one is present). If no scheduling is desired, then
542- /// the `send_deferred` guarantees that there will be no reschedulings.
543540 ///
544541 /// # Failure
545542 ///
@@ -561,15 +558,6 @@ impl<T: Send> Chan<T> {
561558 }
562559 }
563560
564- /// This function is equivalent in the semantics of `send`, but it
565- /// guarantees that a rescheduling will never occur when this method is
566- /// called.
567- pub fn send_deferred ( & self , t : T ) {
568- if !self . try_send_deferred ( t) {
569- fail ! ( "sending on a closed channel" ) ;
570- }
571- }
572-
573561 /// Attempts to send a value on this channel, returning whether it was
574562 /// successfully sent.
575563 ///
@@ -585,9 +573,8 @@ impl<T: Send> Chan<T> {
585573 /// be tolerated, then this method should be used instead.
586574 pub fn try_send ( & self , t : T ) -> bool { self . try ( t, true ) }
587575
588- /// This function is equivalent in the semantics of `try_send`, but it
589- /// guarantees that a rescheduling will never occur when this method is
590- /// called.
576+ /// This function will not stick around for very long. The purpose of this
577+ /// function is to guarantee that no rescheduling is performed.
591578 pub fn try_send_deferred ( & self , t : T ) -> bool { self . try ( t, false ) }
592579
593580 fn try ( & self , t : T , can_resched : bool ) -> bool {
@@ -649,25 +636,9 @@ impl<T: Send> SharedChan<T> {
649636 }
650637 }
651638
652- /// This function is equivalent in the semantics of `send`, but it
653- /// guarantees that a rescheduling will never occur when this method is
654- /// called.
655- pub fn send_deferred ( & self , t : T ) {
656- if !self . try_send_deferred ( t) {
657- fail ! ( "sending on a closed channel" ) ;
658- }
659- }
660-
661639 /// Equivalent method to `try_send` on the `Chan` type (using the same
662640 /// semantics)
663- pub fn try_send ( & self , t : T ) -> bool { self . try ( t, true ) }
664-
665- /// This function is equivalent in the semantics of `try_send`, but it
666- /// guarantees that a rescheduling will never occur when this method is
667- /// called.
668- pub fn try_send_deferred ( & self , t : T ) -> bool { self . try ( t, false ) }
669-
670- fn try ( & self , t : T , can_resched : bool ) -> bool {
641+ pub fn try_send ( & self , t : T ) -> bool {
671642 unsafe {
672643 // Note that the multiple sender case is a little tricker
673644 // semantically than the single sender case. The logic for
@@ -704,7 +675,7 @@ impl<T: Send> SharedChan<T> {
704675
705676 match ( * packet) . increment ( ) {
706677 DISCONNECTED => { } // oh well, we tried
707- -1 => { ( * packet) . wakeup ( can_resched ) ; }
678+ -1 => { ( * packet) . wakeup ( true ) ; }
708679 n => {
709680 if n > 0 && n % RESCHED_FREQ == 0 {
710681 let task: ~Task = Local :: take ( ) ;
0 commit comments