ualarm() — Set the interval timer

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single Unix Standard, Version 3

both

POSIX(ON)

Format

#define _XOPEN_SOURCE_EXTENDED 1
#include <unistd.h>

useconds_t ualarm(useconds_t uscs, useconds_t intrval)

General description

The ualarm() function causes the SIGALRM signal to be generated for the calling process after the number of real-time microseconds specified by the uscs argument has elapsed. When the intrval argument is nonzero, repeated timeout notification occurs with a period in microseconds specified by the intrval argument. If the notification signal, SIGALRM, is not caught or ignored, the calling process is terminated.

The ualarm() function is a simplified interface to setitimer() and uses the ITIMER_REAL interval timer.

Note: The ualarm() and usleep() functions have been moved to obsolescence in Single UNIX Specification, Version 3 and may be withdrawn in a future version. The setitimer(), timer_create(), timer_delete(), timer_getoverrun(), timer_gettime(), or timer_settime() functions are preferred for portability.

Returned value

ualarm() returns the number of microseconds remaining from the previous ualarm(), alarm(), or setitimer(ITIMER_REAL) call.

If no timeouts are pending, ualarm() returns 0.

No errnos are defined for the ualarm() function.

Related information