atap 0.1.0

Threadsafe futureless async runtime for macOS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
//! # Retried
//! Running a syscall again when a signal interrupts it

use crate::{RuntimeError, modules::int_check::IntCheck};

/// Runs a syscall until it says something other than `EINTR`
pub(crate) fn retried(mut call: impl FnMut() -> libc::c_int) -> Result<libc::c_int, RuntimeError> {
    loop {
        match call().check() {
            Err(RuntimeError::CheckError(Some(libc::EINTR))) => continue,
            other => return other,
        }
    }
}