## NAME

sleep, usleep - suspend execution for an interval

## SYNOPSIS

#include <unistd.h>

unsigned int sleep(unsigned int seconds);
int usleep(useconds_t useconds);

## DESCRIPTION

The sleep() function causes the calling thread to be suspended from execution until either the number of realtime seconds specified by the argument seconds 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 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.

## RETURN VALUES

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.

## ERRORS

sleep() doesn't return any errors.

usleep() fails and returns the corresponding value if any of the following conditions occur:

EINTR
  The function was interrupted by a signal.
EINVAL
  The time interval specified one million or more microseconds.

## SEE ALSO

nanosleep()

#### Home page (Kernel)

## < Copyright Rowebots Research Inc. and Multiprocessor Toolsmiths Inc. 1987-2018 >