fn start_waking(
        &self,
        to_poll: u8,
    ) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)> {
        let value = self
            .state
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |value| {
                let mut next_value = value | to_poll;
                if value & (WOKEN | POLLING) == NONE {
                    next_value |= WAKING;
                }

                if next_value != value {
                    Some(next_value)
                } else {
                    None
                }
            })
            .ok()?;

        // Only start the waking process if we're not in the polling/waking phase and the stream isn't woken already
        if value & (WOKEN | POLLING | WAKING) == NONE {
            let bomb = PollStateBomb::new(self, SharedPollState::stop_waking);

            Some((value, bomb))
        } else {
            None
        }
    }
/// Attempts to start the waking process and performs bitwise or with the given value.
///
/// If some waker is already in progress or stream is already woken/being polled, waking process won't start, however
/// state will be disjuncted with the given value.
Attempts to start the waking process and performs bitwise or with the given value.
If some waker is already in progress or stream is already woken/being polled, waking process won't start, however
state will be disjuncted with the given value.
Attempts to start the waking process and performs bitwise or with the given value . If some waker is already in progress or stream is already woken / being polled waking process won ' t start however state will be disjuncted with the given value .
fn start_waking(
        &self,
        to_poll: u8,
    ) -> Option<(u8, PollStateBomb<'_, impl FnOnce(&SharedPollState) -> u8>)> {
        let value = self
            .state
            .fetch_update(Ordering::SeqCst, Ordering::SeqCst, |value| {
                let mut next_value = value | to_poll;
                if value & (WOKEN | POLLING) == NONE {
                    next_value |= WAKING;
                }
                if next_value != value {
                    Some(next_value)
                } else {
                    None
                }
            })
            .ok()?;
        // Only start the waking process if we're not in the polling/waking phase and the stream isn't woken already
        if value & (WOKEN | POLLING | WAKING) == NONE {
            let bomb = PollStateBomb::new(self, SharedPollState::stop_waking);
            Some((value, bomb))
        } else {
            None
        }
    }
fn start_waking ( & self , to_poll : u8 , ) -> Option < ( u8 , PollStateBomb < ' _ , impl FnOnce ( & SharedPollState ) -> u8 > ) > { let value = self . state . fetch_update ( Ordering :: SeqCst , Ordering :: SeqCst , | value | { let mut next_value = value | to_poll ; if value & ( WOKEN | POLLING ) == NONE { next_value |= WAKING ; } if next_value != value { Some ( next_value ) } else { None } } ) . ok ( ) ? ; // Only start the waking process if we're not in the polling/waking phase and the stream isn't woken already if value & ( WOKEN | POLLING | WAKING ) == NONE { let bomb = PollStateBomb :: new ( self , SharedPollState :: stop_waking ) ; Some ( ( value , bomb ) ) } else { None } }
Attempts to start the waking process and performs bitwise or with the given value.
Attempts to start the waking process and performs bitwise or with the given value .
&self
to_poll
u8
&self
to_poll
u8