Updated: October 28, 2024 |
Schedule a SIGALRM for delivery
#include <sys/neutrino.h> int TimerAlarm( clockid_t id, const struct _itimer * itime, struct _itimer * otime ); int TimerAlarm_r( clockid_t id, const struct _itimer * itime, struct _itimer * otime );
While the processor isn't in a power-saving mode, CLOCK_SOFTTIME behaves the same as CLOCK_REALTIME.
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.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
These kernel calls activate an internal timer to schedule an alarm signal (SIGALRM) for delivery to the process. The signal will be delivered at the time specified by itime. If otime isn't NULL, the old trigger time is written into this structure.
The TimerAlarm() and TimerAlarm_r() functions are identical except in the way they indicate errors. See the Returns section for details.
The _itimer structure contains at least the following members:
Alarm requests aren't stacked; only a single SIGALRM may be outstanding on a timer at one time. If you call TimerAlarm() while an alarm is outstanding, the alarm is reset to the new value passed in itime.
If itime is 0, the function returns right away. If it's NULL, the function doesn't schedule any signal and just reads the remaining time into otime (assuming it's non-NULL).
Blocking states
These calls don't block.
The only difference between these functions is the way they indicate errors:
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |