libgslutil  1.2.3
Functions
Sleeping routines

Functions

int safe_sleep_fixed (int s, int ns)
 Sleep for fixed period of time. More...
 

Detailed Description

These routines are similar to sleep(3) but more convenient.

Function Documentation

◆ safe_sleep_fixed()

int safe_sleep_fixed ( int  s,
int  ns 
)

Sleep for fixed period of time.

Parameters
sNumber of seconds to sleep for.
nsNumber of nanoseconds to sleep for.
Return values
0on success.
-1on error (and see errno).

This function performs a simple, fixed sleep. It is implemented with nanosleep(2) internally. It will restart the sleep with the remainder of time in the case of signals. It is not very accurate.

It should only ever fail with EINVAL, and then only if s or ns is not in the valid range.