TimerCreate(), TimerCreate_r()

Synopsis:

Arguments:

id

The timing base; supported types are:

CLOCK_REALTIME — the standard POSIX-defined clock.
Timers based on this clock wake up the processor if it's in a power-saving mode.

CLOCK_SOFTTIME — (a QNX Neutrino extension)
this clock is active only when
the processor isn't in a power-saving mode.
For example, an application using a CLOCK_SOFTTIME timer to sleep wouldn't wake up
the processor when the application was due to wake up.
This will allow the processor to enter a power-saving mode.

While the processor isn't in a power-saving mode, CLOCK_SOFTTIME behaves the same as
CLOCK_REALTIME.

CLOCK_MONOTONIC — this clock always increases
at a constant rate and can't be adjusted.

For more information about the different clocks, see
Other clock sources
in the Clocks, Timers, and Getting a Kick Every So Often of
Getting Started with QNX Neutrino.

event

NULL, or a pointer to a
sigevent
structure that contains the event to deliver when the timer fires;
see below.

Library:

libc

Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.

Description:

The TimerCreate() and TimerCreate_r() kernel calls
create a per-process timer using the clock specified by id as the timing base.

These functions are identical except in the way they indicate errors.
See the Returns section for details.

Note:

Instead of using these kernel calls directly, consider calling
timer_create().

In order to create a timer that sends a pulse to a process belonging to a different user,
your process must have the
PROCMGR_AID_TIMER ability enabled.
For more information, see
procmgr_ability().

Use the returned timer ID in subsequent calls to the other timer functions.

The timer is created in the disabled state, and isn't enabled until
you call TimerSettime().

The
sigevent
structure pointed to by event
contains the event to deliver when the timer fires.
We recommend the following event types in this case:

If your process executes in a loop using MsgReceivev(),
then SIGEV_PULSE is a convenient way of receiving timer
pulses.

If you use signals for event notification, note that signals are
always delivered to the process and not directly to the thread that
created or armed the timer.
You can change this by using a
sigev_notify of SIGEV_SIGNAL_THREAD.

The notify types of SIGEV_UNBLOCK and
SIGEV_INTR, while allowed, are of questionable use with
timers. SIGEV_UNBLOCK is typically used by the
TimerTimeout() kernel call, and SIGEV_INTR
is typically used with
the InterruptWait() kernel call.

If the event argument is NULL, a
SIGALRM signal is sent to your process when the timer expires.
To specify a handler for this signal, call
sigaction().