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

pub fn aio_suspend(list: &[&AioCb<'_>], timeout: Option<TimeSpec>) -> Result<()>

Suspends the calling process until at least one of the specified AioCbs has completed, a signal is delivered, or the timeout has passed.

If timeout is None, aio_suspend will block indefinitely.

Examples

Use aio_suspend to block until an aio operation completes.

const WBUF: &[u8] = b"abcdef123456";
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();
aio_suspend(&[&aiocb], None).expect("aio_suspend failed");
assert_eq!(aiocb.aio_return().unwrap() as usize, WBUF.len());

References

aio_suspend