usleep()

suspend calling thread for microseconds of clock time 

Function


SYNOPSIS

#include <unistd.h>

int usleep(useconds_t period);


DESCRIPTION

The usleep() function suspends the calling thread until either the number of real-time microseconds specified by period has elapsed or a signal is delivered to the calling thread. The suspension time may be longer than requested because the argument value is rounded up to an integer multiple of the sleep resolution, or due to the scheduling of other activity by the system.


PARAMETERS

period 

Is the number of real-time (as opposed to CPU-time) microseconds to suspend the calling thread. This value must be less than 1,000,000. If this value is 0, the call has no effect.


RETURN VALUES

If successful, usleep() returns 0. On failure, it returns -1 and sets errno to one of the following values:

EINVAL 

period is greater than or equal to 1,000,000.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

usleep() 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.

On 8.1/2012R2/10/2016/2019/11/2022, waitable timers with 100-nanosecond resolution are available, so usleep() has microsecond accuracy.

usleep() can be configured to wake the system from a suspended power conservation mode when the specified interval expires. See _NutConf() for more details.


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:
_NutConf(), alarm(), getitimer(), kill(), nanosleep(), nap(), pause(), sigaction(), signal(), sigpause(), sleep()


PTC MKS Toolkit 10.4 Documentation Build 39.