OpenBSD manual page server

Manual Page Search Parameters

UALARM(3) Library Functions Manual UALARM(3)

ualarmschedule high resolution SIGALRM delivery

#include <unistd.h>

useconds_t
ualarm(useconds_t microseconds, useconds_t interval);

This is a simplified interface to setitimer(2).

The () function schedules the SIGALRM signal for delivery to the calling process after at least the given number of microseconds have elapsed. If interval is non-zero, the SIGALRM signal is scheduled for redelivery to the calling process every interval microseconds thereafter.

If an alarm is already pending, an additional call to () supersedes the prior call.

If microseconds is zero, any pending alarm is cancelled and the value of interval is ignored.

The ualarm() function returns the number of microseconds remaining until the next alarm is scheduled for delivery, or zero if no alarm is pending.

setitimer(2), sigaction(2), sigsuspend(2), alarm(3), signal(3), sleep(3), usleep(3)

The ualarm() function conforms to X/Open Portability Guide Issue 4, Version 2 (“XPG4.2”).

The ualarm() function first appeared in 4.3BSD.

The ualarm() function is implemented with the per-process ITIMER_REAL timer described in setitimer(2). Use of both ualarm() and setitimer(2) in the same program may yield confusing behavior.

August 1, 2023 OpenBSD-current