sleep, usleep - suspend execution for an interval
#include <unistd.h>
The usleep() function causes the calling thread to be suspended from execution until either the number of realtime microseconds specified by the argument useconds 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.
The useconds argument shall be less than one million. If the value of useconds is 0, then the call has no effect.
If sleep() returns because the requested time has elapsed, the value returned will be 0. If sleep() returns due to delivery of a signal, the return value will be the "unslept" amount (the requested time minus the time actually slept) in seconds.
Upon successful completion, usleep() returns 0; otherwise, it returns -1 and set errno to indicate the error.
sleep() doesn't return any errors.
usleep() fails and returns the corresponding value if any of the following conditions occur: