Function nix::sys::aio::aio_cancel_all[][src]

pub fn aio_cancel_all(fd: RawFd) -> Result<AioCancelStat>
Expand description

Cancels outstanding AIO requests for a given file descriptor.

Examples

Issue an aio operation, then cancel all outstanding operations on that file descriptor.

let wbuf = b"CDEF";
let mut f = tempfile().unwrap();
let mut aiocb = AioCb::from_slice( f.as_raw_fd(),
    2,   //offset
    &wbuf[..],
    0,   //priority
    SigevNotify::SigevNone,
    LioOpcode::LIO_NOP);
aiocb.write().unwrap();
let cs = aio_cancel_all(f.as_raw_fd()).unwrap();
if cs == AioCancelStat::AioNotCanceled {
    while (aiocb.error() == Err(Error::from(Errno::EINPROGRESS))) {
        thread::sleep(time::Duration::from_millis(10));
    }
}
// Must call `aio_return`, but ignore the result
let _ = aiocb.aio_return();

References

aio_cancel