pub fn take_waker(&self) -> Option<Waker> {
        debug!(" + take_waker");
        // AcqRel ordering is used in order to acquire the value of the `waker`
        // cell as well as to establish a `release` ordering with whatever
        // memory the `AtomicWaker` is associated with.
        match self.state.fetch_or(WAKING, AcqRel) {
            WAITING => {
                debug!(" + WAITING");
                // The waking lock has been acquired.
                let waker = unsafe { self.waker.with_mut(|t| (*t).take()) };

                // Release the lock
                self.state.fetch_and(!WAKING, Release);
                debug!(" + Done taking");

                waker
            }
            state => {
                debug!(" + state = {:?}", state);
                // There is a concurrent thread currently updating the
                // associated waker.
                //
                // Nothing more to do as the `WAKING` bit has been set. It
                // doesn't matter if there are concurrent registering threads or
                // not.
                //
                debug_assert!(
                    state == REGISTERING || state == REGISTERING | WAKING || state == WAKING
                );
                None
            }
        }
    }
/// Attempts to take the `Waker` value out of the `AtomicWaker` with the
/// intention that the caller will wake the task later.
Attempts to take the `Waker` value out of the `AtomicWaker` with the
intention that the caller will wake the task later.
Attempts to take the ` Waker ` value out of the ` AtomicWaker ` with the intention that the caller will wake the task later .
pub fn take_waker(&self) -> Option<Waker> {
        debug!(" + take_waker");
        // AcqRel ordering is used in order to acquire the value of the `waker`
        // cell as well as to establish a `release` ordering with whatever
        // memory the `AtomicWaker` is associated with.
        match self.state.fetch_or(WAKING, AcqRel) {
            WAITING => {
                debug!(" + WAITING");
                // The waking lock has been acquired.
                let waker = unsafe { self.waker.with_mut(|t| (*t).take()) };
                // Release the lock
                self.state.fetch_and(!WAKING, Release);
                debug!(" + Done taking");
                waker
            }
            state => {
                debug!(" + state = {:?}", state);
                // There is a concurrent thread currently updating the
                // associated waker.
                //
                // Nothing more to do as the `WAKING` bit has been set. It
                // doesn't matter if there are concurrent registering threads or
                // not.
                //
                debug_assert!(
                    state == REGISTERING || state == REGISTERING | WAKING || state == WAKING
                );
                None
            }
        }
    }
pub fn take_waker ( & self ) -> Option < Waker > { debug ! ( " " ) ; // AcqRel ordering is used in order to acquire the value of the `waker` // cell as well as to establish a `release` ordering with whatever // memory the `AtomicWaker` is associated with. match self . state . fetch_or ( WAKING , AcqRel ) { WAITING => { debug ! ( " " ) ; // The waking lock has been acquired. let waker = unsafe { self . waker . with_mut ( | t | ( * t ) . take ( ) ) } ; // Release the lock self . state . fetch_and ( ! WAKING , Release ) ; debug ! ( " " ) ; waker } state => { debug ! ( " " state ) ; // There is a concurrent thread currently updating the // associated waker. // // Nothing more to do as the `WAKING` bit has been set. It // doesn't matter if there are concurrent registering threads or // not. // debug_assert ! ( state REGISTERING state REGISTERING WAKING state WAKING ) ; None } } }
Attempts to take the `Waker` value out of the `AtomicWaker` with the
intention that the caller will wake the task later.
Attempts to take the ` Waker ` value out of the ` AtomicWaker ` with the intention that the caller will wake the task later .
&self
&self