use crate::{backend, io};
pub use backend::time::types::Timespec;
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
)))]
pub use backend::time::types::ClockId;
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
)))]
#[inline]
pub fn clock_nanosleep_relative(id: ClockId, request: &Timespec) -> NanosleepRelativeResult {
backend::thread::syscalls::clock_nanosleep_relative(id, request)
}
#[cfg(not(any(
apple,
target_os = "dragonfly",
target_os = "emscripten",
target_os = "freebsd", // FreeBSD 12 has clock_nanosleep, but libc targets FreeBSD 11.
target_os = "haiku",
target_os = "openbsd",
target_os = "redox",
target_os = "wasi",
)))]
#[inline]
pub fn clock_nanosleep_absolute(id: ClockId, request: &Timespec) -> io::Result<()> {
backend::thread::syscalls::clock_nanosleep_absolute(id, request)
}
#[inline]
pub fn nanosleep(request: &Timespec) -> NanosleepRelativeResult {
backend::thread::syscalls::nanosleep(request)
}
#[derive(Debug, Clone)]
#[must_use]
pub enum NanosleepRelativeResult {
Ok,
Interrupted(Timespec),
Err(io::Errno),
}