timer_create()

create a per-process timer 

Realtime Function


SYNOPSIS

#include <signal.h>

#include <time.h>

int timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid);


DESCRIPTION

The timer_create() function creates a per-process timer based on the clock specified by clockid. When created, this timer is disarmed. Additionally, this function returns a timer ID (unique within the process) of the type timer_t in the location pointed to by timerid. You can use this timer ID with other functions to refer to this timer.

You can specify the asynchronous notification that takes place when the newly created timer expires by pointing evp at a sigevent structure. However, if evp is a null pointer, the results are the same as having pointed evp at a sigevent structure with its sigev_notify member set to SIGEV_SIGNAL, its sigev_signo set to the default signal number, and its sigev_value set to the value pointed to by timerid.

Child processes created with the fork(), exec(), or _NutForkExec() do not inherit per-process timers.

Note:

Timers are active in a child created with vfork(). Thus, attempting to manipulate such a timer between a vfork() call and an exec() call results in that timer being modified in the parent process.


PARAMETERS

clockid 

Specifies the ID of the clock on which the new timer is based. On the NuTCRACKER Platform, this can only be CLOCK_REALTIME.

evp 

Identifies the asynchronous notification to take place when the timer expires. Normally, this is a pointer to a sigevent structure.

timerid 

Points to the location where this function stores the timer ID for the newly created timer.


RETURN VALUES

When successful, timer_create() returns 0.

Otherwise, it returns -1 and sets errno to one of the following:

EFAULT 

The clock_id argument is a bad pointer.

EINVAL 

The value specified for clock_id is not a valid clock ID.

ENOTSUP 

The clock specified by clock_id is not supported for this function on the NuTCRACKER Platform.


CONFORMANCE

UNIX 03.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

api_intro

Functions:
clock_getres(), timer_delete(), timer_getoverrun()

Miscellaneous:
struct sigevent


PTC MKS Toolkit 10.4 Documentation Build 39.