fn react(&self, timeout: Option<Duration>) -> io::Result<()> {
        // FIXME: use shrink_to here to bring the capacity back to
        // its normal level. It is not stable API yet and this is unlikely
        // to be a problem in practice.
        let mut wakers = self.wakers.borrow_mut();

        // Process ready timers.
        let next_timer = self.process_timers(&mut wakers);
        self.process_shared_channels(&mut wakers);

        // Block on I/O events.
        let res = match self.sys.wait(&mut wakers, timeout, next_timer, |wakers| {
            self.process_shared_channels(wakers)
        }) {
            // Don't wait for the next loop to process timers or shared channels
            Ok(true) => {
                self.process_timers(&mut wakers);
                Ok(())
            }

            Ok(false) => Ok(()),

            // The syscall was interrupted.
            Err(err) if err.kind() == io::ErrorKind::Interrupted => Ok(()),

            // An actual error occureed.
            Err(err) => Err(err),
        };

        // Wake up ready tasks.
        for waker in wakers.drain(..) {
            // Don't let a panicking waker blow everything up.
            if let Err(x) = panic::catch_unwind(|| waker.wake()) {
                error!("Panic while calling waker! {:?}", x);
            }
        }

        res
    }
/// Processes new events, blocking until the first event or the timeout.
Processes new events, blocking until the first event or the timeout.
Processes new events blocking until the first event or the timeout .
fn react(&self, timeout: Option<Duration>) -> io::Result<()> {
        // FIXME: use shrink_to here to bring the capacity back to
        // its normal level. It is not stable API yet and this is unlikely
        // to be a problem in practice.
        let mut wakers = self.wakers.borrow_mut();
        // Process ready timers.
        let next_timer = self.process_timers(&mut wakers);
        self.process_shared_channels(&mut wakers);
        // Block on I/O events.
        let res = match self.sys.wait(&mut wakers, timeout, next_timer, |wakers| {
            self.process_shared_channels(wakers)
        }) {
            // Don't wait for the next loop to process timers or shared channels
            Ok(true) => {
                self.process_timers(&mut wakers);
                Ok(())
            }
            Ok(false) => Ok(()),
            // The syscall was interrupted.
            Err(err) if err.kind() == io::ErrorKind::Interrupted => Ok(()),
            // An actual error occureed.
            Err(err) => Err(err),
        };
        // Wake up ready tasks.
        for waker in wakers.drain(..) {
            // Don't let a panicking waker blow everything up.
            if let Err(x) = panic::catch_unwind(|| waker.wake()) {
                error!("Panic while calling waker! {:?}", x);
            }
        }
        res
    }
fn react ( & self , timeout : Option < Duration > ) -> io :: Result < ( ) > { // FIXME: use shrink_to here to bring the capacity back to // its normal level. It is not stable API yet and this is unlikely // to be a problem in practice. let mut wakers = self . wakers . borrow_mut ( ) ; // Process ready timers. let next_timer = self . process_timers ( & mut wakers ) ; self . process_shared_channels ( & mut wakers ) ; // Block on I/O events. let res = match self . sys . wait ( & mut wakers , timeout , next_timer , | wakers | { self . process_shared_channels ( wakers ) } ) { // Don't wait for the next loop to process timers or shared channels Ok ( true ) => { self . process_timers ( & mut wakers ) ; Ok ( ( ) ) } Ok ( false ) => Ok ( ( ) ) , // The syscall was interrupted. Err ( err ) if err . kind ( ) == io :: ErrorKind :: Interrupted => Ok ( ( ) ) , // An actual error occureed. Err ( err ) => Err ( err ) , } ; // Wake up ready tasks. for waker in wakers . drain ( .. ) { // Don't let a panicking waker blow everything up. if let Err ( x ) = panic :: catch_unwind ( | | waker . wake ( ) ) { error ! ( " " x ) ; } } res }
Processes new events, blocking until the first event or the timeout.
Processes new events blocking until the first event or the timeout .
&self
timeout
Option<Duration>
&self
timeout
Option<Duration>