timer_create(3R)
NAME
timer_create − create a per-LWP timer
SYNOPSIS
cc [ flag ... ] file ... −lposix4 [ library ... ]
#include <signal.h>
#include <time.h>
int timer_create(clockid_t clock_id, struct sigevent ∗evp, timer_t ∗timerid);
struct sigevent {
intsigev_notify/∗ notification type ∗/
intsigev_signo;/∗ signal number ∗/
union sigvalsigev_value;/∗ signal value ∗/
};
union sigval {
intsival_int;/∗ integer value ∗/
void∗sival_ptr;/∗ pointer value ∗/
};
MT-LEVEL
MT-Safe with exceptions
DESCRIPTION
timer_create() creates a timer per-LWP using the specified clock, clock_id, as the timing base. This timer ID is unique and meaningful only within the calling LWP until the timer is deleted. This timer is initially disarmed upon return from timer_create().
If evp is non-NULL:
then evp points to a sigevent structure, allocated by the application, which defines the asynchronous notification that will occur when the timer expires.
If the sigev_notify member of evp is SIGEV_SIGNAL, then the structure also contains the signal number and the application specific data value to be sent to the process. If SA_SIGINFO is set for the expiration signal, then the signal and application-defined value specified in the structure will be queued to the process on timer expiration. If SA_SIGINFO is not set for the expiration signal, then the signal specified in the structure will be sent to the LWP upon the timer expiration.
If the sigev_notify member is SIGEV_NONE, no notification will be sent.
If evp is NULL, and SA_SIGINFO is set for the expiration signal, then the default signal, SIGALRM, will be queued to the process and the signal data value will be set to the timer ID.
RETURN VALUES
timer_create() returns 0 upon success and creates a timer_t, timerid, which can be passed to the timer calls; otherwise it returns -1 and sets errno to indicate the error condition.
ERRORS
EAGAIN The system lacks sufficient signal queuing resources to honor the request. The calling process has already created all of the timers it is allowed by this implementation.
EINVAL The specified clock ID, clock_id, is not defined.
ENOSYS timer_create() is not supported by this implementation.
SEE ALSO
exec(2), fork(2), time(2), clock_settime(3R), timer_delete(3R), timer_settime(3R)
NOTES
Timers are not inherited by a child process across a fork(2) and can be disarmed and deleted by an exec(2).
Sun Microsystems — Last change: 12 Aug 1993