fn add_source(&self, source: &Evented)
        -> io::Result<usize>
    {
        let mut io_dispatch = self.io_dispatch.write().unwrap();

        if io_dispatch.len() == MAX_SOURCES {
            return Err(io::Error::new(io::ErrorKind::Other, "reactor at max registered I/O resources"));
        }

        // Acquire a write lock
        let key = io_dispatch.insert(ScheduledIo {
            readiness: AtomicUsize::new(0),
            reader: AtomicTask::new(),
            writer: AtomicTask::new(),
        });

        try!(self.io.register(source,
                              mio::Token(TOKEN_START + key),
                              mio::Ready::readable() |
                                mio::Ready::writable() |
                                platform::all(),
                              mio::PollOpt::edge()));

        Ok(key)
    }
/// Register an I/O resource with the reactor.
///
/// The registration token is returned.
Register an I/O resource with the reactor.
The registration token is returned.
Register an I / O resource with the reactor . The registration token is returned .
fn add_source(&self, source: &Evented)
        -> io::Result<usize>
    {
        let mut io_dispatch = self.io_dispatch.write().unwrap();
        if io_dispatch.len() == MAX_SOURCES {
            return Err(io::Error::new(io::ErrorKind::Other, "reactor at max registered I/O resources"));
        }
        // Acquire a write lock
        let key = io_dispatch.insert(ScheduledIo {
            readiness: AtomicUsize::new(0),
            reader: AtomicTask::new(),
            writer: AtomicTask::new(),
        });
        try!(self.io.register(source,
                              mio::Token(TOKEN_START + key),
                              mio::Ready::readable() |
                                mio::Ready::writable() |
                                platform::all(),
                              mio::PollOpt::edge()));
        Ok(key)
    }
fn add_source ( & self , source : & Evented ) -> io :: Result < usize > { let mut io_dispatch = self . io_dispatch . write ( ) . unwrap ( ) ; if io_dispatch . len ( ) == MAX_SOURCES { return Err ( io :: Error :: new ( io :: ErrorKind :: Other , " " ) ) ; } // Acquire a write lock let key = io_dispatch . insert ( ScheduledIo { readiness : AtomicUsize :: new ( 0 ) , reader : AtomicTask :: new ( ) , writer : AtomicTask :: new ( ) , } ) ; try ! ( self io register ( source mio Token ( TOKEN_START key ) mio Ready readable ( ) mio Ready writable ( ) platform all ( ) mio PollOpt edge ( ) ) ) ; Ok ( key ) }
Register an I/O resource with the reactor.
Register an I / O resource with the reactor .
&self
source
&Evented
&self
source
&Evented