/// Construct a new channel AIO context. When there are more than
/// lowwater ops pending it will flush automatically; new
/// operations will block when there's max or more outstanding
/// operations (batched and submitted). Returns the submission and
/// results channel endpoints.
Construct a new channel AIO context. When there are more than
lowwater ops pending it will flush automatically; new
operations will block when there's max or more outstanding
operations (batched and submitted). Returns the submission and
results channel endpoints.
Construct a new channel AIO context . When there are more than lowwater ops pending it will flush automatically ; new operations will block when there ' s max or more outstanding operations ( batched and submitted ) . Returns the submission and results channel endpoints .
pub fn new(lowwater: usize, max: usize) -> io::Result<Iocontext<T, Wb, Rb>> {
        assert!(lowwater > 0 && lowwater < max);
        let mut ctx = try!(raw::Iocontext::new(max));
        // Prepare events
        let evfd = try!(ctx.get_evfd_stream());
        let (optx, oprx) = sync_channel(max); // block requests when there are too many outstanding
        let (restx, resrx) = channel();       // don't block worker - there can't be more than requests anyway
        thread::spawn(move || {
            let mut worker = ChanWorker { ctx: ctx, lowwater: lowwater };
            worker.worker(oprx, restx, evfd)
        });
        Ok(Iocontext { optx: optx, resrx: resrx })
    }
pub fn new ( lowwater : usize , max : usize ) -> io :: Result < Iocontext < T , Wb , Rb > > { assert ! ( lowwater 0 lowwater max ) ; let mut ctx = try ! ( raw Iocontext new ( max ) ) ; // Prepare events let evfd = try ! ( ctx get_evfd_stream ( ) ) ; let ( optx , oprx ) = sync_channel ( max ) ; // block requests when there are too many outstanding let ( restx , resrx ) = channel ( ) ; // don't block worker - there can't be more than requests anyway thread :: spawn ( move | | { let mut worker = ChanWorker { ctx : ctx , lowwater : lowwater } ; worker . worker ( oprx , restx , evfd ) } ) ; Ok ( Iocontext { optx : optx , resrx : resrx } ) }
Construct a new channel AIO context.
Construct a new channel AIO context .
lowwater
usize
max
usize