nap()

suspend calling thread for given interval (in milliseconds) 

Function


SYNOPSIS

#include <unistd.h>

long nap(long period);


DESCRIPTION

The nap() function suspends the calling thread until either the number of real-time milliseconds specified by period has elapsed or a signal is delivered to the calling thread. The suspension time may be longer than requested due to the scheduling of other activity by the system.


PARAMETERS

period 

Is the number of real-time (as opposed to CPU-time) milliseconds to suspend the calling thread.


RETURN VALUES

If successful, nap() returns a long integer that indicates the number of milliseconds actually slept. On failure, it returns a value of -1 and sets errno to one of the following values:

EINTR 

A signal interrupted the call.


CONFORMANCE

SVR3.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

nap() is implemented using an interruptible wait function, and does not use signals. Hence there are no interactions with SIGALRM handling, or with any other wait function (for example, sleep()), as there are on some UNIX platforms.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
alarm(), getitimer(), kill(), nanosleep(), pause(), sigaction(), signal(), sigpause(), sleep(), usleep()


PTC MKS Toolkit 10.4 Documentation Build 39.