sleep()

suspend calling thread for seconds of clock time 

Function


SYNOPSIS

#include <unistd.h>

unsigned int sleep(unsigned int period);


DESCRIPTION

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


PARAMETERS

period 

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


RETURN VALUES

If the requested time has elapsed, sleep() returns a value of zero. If a signal was delivered, sleep() returns the remaining seconds to sleep.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

sleep() 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, usleep()), as there are on some UNIX platforms.


AVAILABILITY

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


SEE ALSO

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


MKS Toolkit 9.2 Documentation Build 16.