fn broadcast(&self) {
        for (sig, slot) in globals().signals.iter().enumerate() {
            // Any signal of this kind arrived since we checked last?
            if !slot.pending.swap(false, Ordering::SeqCst) {
                continue;
            }

            let signum = sig as c_int;
            let mut recipients = slot.recipients.lock().unwrap();

            // Notify all waiters on this signal that the signal has been
            // received. If we can't push a message into the queue then we don't
            // worry about it as everything is coalesced anyway. If the channel
            // has gone away then we can remove that slot.
            for i in (0..recipients.len()).rev() {
                match recipients[i].try_send(signum) {
                    Ok(()) => {}
                    Err(ref e) if e.is_disconnected() => {
                        recipients.swap_remove(i);
                    }

                    // Channel is full, ignore the error since the
                    // receiver has already been woken up
                    Err(e) => {
                        // Sanity check in case this error type ever gets
                        // additional variants we have not considered.
                        debug_assert!(e.is_full());
                    }
                }
            }
        }
    }
/// Go through all the signals and broadcast everything.
///
/// Driver tasks wake up for *any* signal and simply process all globally
/// registered signal streams, so each task is sort of cooperatively working
/// for all the rest as well.
Go through all the signals and broadcast everything.
Driver tasks wake up for *any* signal and simply process all globally
registered signal streams, so each task is sort of cooperatively working
for all the rest as well.
Go through all the signals and broadcast everything . Driver tasks wake up for * any * signal and simply process all globally registered signal streams so each task is sort of cooperatively working for all the rest as well .
fn broadcast(&self) {
        for (sig, slot) in globals().signals.iter().enumerate() {
            // Any signal of this kind arrived since we checked last?
            if !slot.pending.swap(false, Ordering::SeqCst) {
                continue;
            }
            let signum = sig as c_int;
            let mut recipients = slot.recipients.lock().unwrap();
            // Notify all waiters on this signal that the signal has been
            // received. If we can't push a message into the queue then we don't
            // worry about it as everything is coalesced anyway. If the channel
            // has gone away then we can remove that slot.
            for i in (0..recipients.len()).rev() {
                match recipients[i].try_send(signum) {
                    Ok(()) => {}
                    Err(ref e) if e.is_disconnected() => {
                        recipients.swap_remove(i);
                    }
                    // Channel is full, ignore the error since the
                    // receiver has already been woken up
                    Err(e) => {
                        // Sanity check in case this error type ever gets
                        // additional variants we have not considered.
                        debug_assert!(e.is_full());
                    }
                }
            }
        }
    }
fn broadcast ( & self ) { for ( sig , slot ) in globals ( ) . signals . iter ( ) . enumerate ( ) { // Any signal of this kind arrived since we checked last? if ! slot . pending . swap ( false , Ordering :: SeqCst ) { continue ; } let signum = sig as c_int ; let mut recipients = slot . recipients . lock ( ) . unwrap ( ) ; // Notify all waiters on this signal that the signal has been // received. If we can't push a message into the queue then we don't // worry about it as everything is coalesced anyway. If the channel // has gone away then we can remove that slot. for i in ( 0 .. recipients . len ( ) ) . rev ( ) { match recipients [ i ] . try_send ( signum ) { Ok ( ( ) ) => { } Err ( ref e ) if e . is_disconnected ( ) => { recipients . swap_remove ( i ) ; } // Channel is full, ignore the error since the // receiver has already been woken up Err ( e ) => { // Sanity check in case this error type ever gets // additional variants we have not considered. debug_assert ! ( e is_full ( ) ) ; } } } } }
Go through all the signals and broadcast everything.
Go through all the signals and broadcast everything .
&self
&self