timer in QNX 6.01

Hi,

In QNX 6.0, there are two ways to implement a timer. It not only provides
timer_creater(), but also based on POSIX standards, TimerALarm(). What
difference between them?


Thanks,

Belinda

Belinda <yye@is2.dal.ca> wrote:

Hi,

In QNX 6.0, there are two ways to implement a timer. It not only provides
timer_creater(), but also based on POSIX standards, TimerALarm(). What
difference between them?

First, TimerAlarm is definitely NOT Posix – it is a kernel call.

alarm() would be Posix, and ualarm() would be Unix variants that are
built on TimerAlarm().

The difference: TimerAlarm() and alarm() functions always generate
one SIGALRM when they expire, and you get one alarm timer per process.

timer_create() and family are far more flexible and powerful – you
can request notification in a variety of ways, including any signal
you want, or (QNX extension to the Posix functions) notification by
way of a pulse being sent to you. The timer can be a repeating timer,
and you can have multiple different timers delivering the same or
different events at the same or different times.

So, basically for anything but the default “kill me with a SIGALRM in
xxx time”, you would normally use the powerful and flexible timer_*()
functions.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.

I would not recommend using the TimerAlarm() with QNX6.1. We have had
terrible disk IO problems with a program running with a high frequency
TimerAlarm(). Some of the problems that we have experienced with a 2kHz
TimerAlarm():

  • devb-eide would suddenly die.
  • read/write would suddenly exit with an error before the operation were
    complete.
  • other system calls to the disk (directory functions) would suddenly fail.

Because of the above we would end up with corrupted file systems.

It is almost like some of the disk IO system calls aren’t robust against
SIGALRM.

We changed over to using timer_create() for our high frequency timer and the
all of the above problems went away.


Jens

“David Gibbs” <dagibbs@qnx.com> wrote in message
news:ae7j5v$631$2@nntp.qnx.com

Belinda <> yye@is2.dal.ca> > wrote:
Hi,

In QNX 6.0, there are two ways to implement a timer. It not only
provides
timer_creater(), but also based on POSIX standards, TimerALarm(). What
difference between them?

First, TimerAlarm is definitely NOT Posix – it is a kernel call.

alarm() would be Posix, and ualarm() would be Unix variants that are
built on TimerAlarm().

The difference: TimerAlarm() and alarm() functions always generate
one SIGALRM when they expire, and you get one alarm timer per process.

timer_create() and family are far more flexible and powerful – you
can request notification in a variety of ways, including any signal
you want, or (QNX extension to the Posix functions) notification by
way of a pulse being sent to you. The timer can be a repeating timer,
and you can have multiple different timers delivering the same or
different events at the same or different times.

So, basically for anything but the default “kill me with a SIGALRM in
xxx time”, you would normally use the powerful and flexible timer_*()
functions.

-David

QNX Training Services
http://www.qnx.com/support/training/
Please followup in this newsgroup if you have further questions.