Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ nanosleep(3) — OSF/1 X2.0-8 MIPS

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

sleep(1)

nanosleep(3)  —  Subroutines

Digital

NAME

nanosleep, nanosleep_getres − suspend a process from execution for the specified timer interval or return the resolution and maximum values supported by nanosleep (P1003.4/D10)

SYNOPSIS

#include <timers.h>

int nanosleep (
const struct timespec ∗rqtp ,
struct timespec ∗rmtp) ;

int nanosleep_getres (
struct timespec ∗res ,
struct timespec ∗max) ;

PARAMETERS

rqtp A pointer to the timespec data structure that defines the time interval during which the calling process is suspended. 

rmtp A pointer to the timespec data structure that receives the amount of time remaining in the previously requested interval, or zero if the full interval has elapsed. 

res A pointer to the timespec data structure that receives the resolution supported by nanosleep. 

max A pointer to the timespec data structure that receives the maximum allowed value supported for nanosleep. 

DESCRIPTION

The nanosleep function suspends a process until one of the following conditions is met:

•The time interval specified in rqtp has elapsed

•A signal is delivered to the calling process and the signal is for a signal catching function or for terminating the process

The suspension time may be longer than requested because the argument value is rounded up to an integer multiple of the sleep resolution or due to the scheduling of other activity. 

The nanosleep_getres function returns the resolution and maximum values supported by the nanosleep function. If either of the argument pointers is NULL, the corresponding value is not returned. 

RETURN VALUES

When the nanosleep function returns because the requested time has elapsed, the call is successful and a value of 0 is returned. 

If the nanosleep function returns because it was interrupted by a signal, a value of +1 is returned and the unslept amount of time (the time remaining in the interval) is stored in rmtp. 

On an unsuccessful call, a value of −1 is returned and errno is set to indicate that an error occurred. 

ERRORS

The nanosleep function fails under the following conditions:

[EINVAL] The rqtp agrument specified a nanosecond value less than zero or greater than or equal to 1000 million.  The rqtp argument specified a time that exceeds the maximum time supported by the nanosleep function. 

The nanosleep_getres function does not fail. 

RELATED INFORMATION

sleep(1)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026