devela::all

Function linux_sys_nanosleep

Source
pub unsafe fn linux_sys_nanosleep(
    req: *const LinuxTimespec,
    rem: *mut LinuxTimespec,
) -> isize 
Available on crate features unsafe_syscall and linux only.
Expand description

Performs a nanosleep syscall.

Suspend execution of calling thread.

Suspension will last until either the time interval specified in *req has elapsed or a signal is delivered to the calling thread, in which case the remaining time will be stored in rem.

Returns the syscall return value.

§Info

§Example

use devela::{linux_sys_nanosleep, Duration, LinuxTimespec};

let mut req = LinuxTimespec::from(Duration::from_millis(99));
let mut rem = LinuxTimespec::default();
assert_eq![0, unsafe { linux_sys_nanosleep(&mut req, &mut rem) }];

§Safety

TODO