Suspends the execution of the current process (or thread in a threaded program) for at least the number of seconds indicated by its argument. Format #include <unistd.h> unsigned int sleep (unsigned seconds); (_DECC_V4_SOURCE) int sleep (unsigned seconds); (not _DECC_V4_SOURCE)
1 – Argument
seconds The number of seconds.
2 – Description
The sleep function sleeps for the specified number of seconds, or until a signal is received, or until the process (or thread in a threaded program) executes a call to SYS$WAKE. If a SIGALRM signal is generated, but blocked or ignored, the sleep function returns. For all other signals, a blocked or ignored signal does not cause sleep to return.
3 – Return Values
x The number of seconds that the process awoke early. 0 If the process slept the full number of seconds specified by seconds.