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

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

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.as_ref()], None).expect("aio_suspend failed");
assert_eq!(aiocb.aio_return().unwrap() as usize, WBUF.len());

References

aio_suspend