Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

clock_getres(3)

clock_gettime(3)

clock_settime(3)

timer_delete(3)

timer_gettime(3)

timer_settime(3)

timer_create(3)  —  Subroutines

NAME

timer_create − Allocate a per-process timer (P1003.1b)

SYNOPSIS

#include <signal.h>
#include <time.h>

int timer_create (
     clockid_t clock_id,
     struct sigevent ∗evp,
     timer_t ∗timerid);

PARAMETERS

clock_idThe type of clock on which the timer is based. The CLOCK_REALTIME clock is supported. 

∗evpA pointer to a sigevent structure, which defines the signal sent to the process on timer expiration. 

∗timeridA pointer to the timer ID returned by the call to the timer_create function. 

DESCRIPTION

The timer_create function allocates a per-process timer using the specified clock as the timing base. The timer_create function returns a timer ID, which is used to identify the timer in timer requests. The timer ID is unique within the calling process until the timer is deleted. The timer is unarmed when first returned from a call to timer_create. To arm the timer, use the timer_settime function. 

The evp argument specifies the signal that is sent to the calling process when the timer expires. The signal is specified in the sigevent structure, which is defined in the <signal.h> header file. 

SIGALRM is the default signal for CLOCK_REALTIME and a NULL evp argument. 

The maximum number of timers supported per process (TIMER_MAX) is defined in the <sys/rt_limits.h> header file, which is indirectly included through time.h. 

Timers are not inherited across fork or exec calls. 

RETURN VALUES

On a successful call to the timer_create function, a timer ID is returned. This timer ID can be passed to other realtime timer functions. 

On an unsuccessful call, a value of −1 is returned and errno is set to indicate that an error occurred. 

ERRORS

The timer_create function fails under the following conditions:

[EAGAIN]The system lacks sufficient signal queuing resources to honor the request. 

[EINVAL]The specified clock ID is not defined. 

[ENOSYS]The function timer_create is not supported by this implementation. 

RELATED INFORMATION

Functions: clock_getres(3), clock_gettime(3), clock_settime(3), timer_delete(3), timer_gettime(3), timer_settime(3)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026