timer_create.2freebsd

Langue: en

Autres versions - même langue

Version: 315719 (ubuntu - 07/07/09)

Section: 2 (Appels système)


BSD mandoc

NAME

timer_create - create a per-process timer (REALTIME)

LIBRARY

Lb librt

SYNOPSIS

In time.h Ft int Fo timer_create Fa clockid_t clockid struct sigevent *restrict evp Fa timer_t *restrict timerid Fc  

DESCRIPTION

The Fn timer_create system call creates a per-process timer using the specified clock, Fa clock_id , as the timing base. The Fn timer_create system call returns, in the location referenced by Fa timerid , a timer ID of type Vt timer_t used to identify the timer in timer requests. This timer ID is unique within the calling process until the timer is deleted. The particular clock, Fa clock_id , is defined in In time.h . The timer whose ID is returned is in a disarmed state upon return from Fn timer_create .

The Fa evp argument, if non- NULL points to a Vt sigevent structure. This structure, allocated by the application, defines the asynchronous notification to occur when the timer expires. If the Fa evp argument is NULL the effect is as if the Fa evp argument pointed to a Vt sigevent structure with the sigev_notify member having the value SIGEV_SIGNAL the sigev_signo having a default signal number, and the sigev_value member having the value of the timer ID.

The implementations supports a Fa clock_id of CLOCK_REALTIME or CLOCK_MONOTONIC

If Fa evp->sigev_sigev_notify is SIGEV_THREAD and Fa sev->sigev_notify_attributes is not NULL if the attribute pointed to by Fa sev->sigev_notify_attributes has a thread stack address specified by a call to Fn pthread_attr_setstack or Fn pthread_attr_setstackaddr , the results are unspecified if the signal is generated more than once.

RETURN VALUES

If the call succeeds, Fn timer_create returns zero and updates the location referenced by Fa timerid to a Vt timer_t , which can be passed to the per-process timer calls. If an error occurs, the system call returns a value of -1 and the global variable errno is set to indicate the error. The value of Fa timerid is undefined if an error occurs.

ERRORS

The Fn timer_create system call will fail if:
Bq Er EAGAIN
The calling process has already created all of the timers it is allowed by this implementation.
Bq Er EINVAL
The specified clock ID is not supported.
Bq Er EFAULT
Any arguments point outside the allocated address space or there is a memory protection fault.

SEE ALSO

clock_getres2, timer_delete2, timer_getoverun2, siginfo(3)

STANDARDS

The Fn timer_create system call conforms to St -p1003.1-2004

HISTORY

Support for POSIX per-process timer first appeared in Fx 7.0 .