QNX6 Timers

Under QNX4, timer_settime() can be used to schedule a thread and run a function periodically inside the thread. Windows provides the same thing with SetTimer(). However under QNX6, the argument list for timer_settime() does not provide a way to pass a function.

Any ideas on how to acheive something similar to above on QNX6?

It take a sigevent, which, you can initialize a SIGEV_THREAD (look at your sys/siginfo.h) to it. This will result a new thread being created, and the specific funcitons being execuated. But this is a very expensive way.

The “usual” way is to prepare a “SIGEV_PULSE”, and receive that pulse.
With dispatcher, you can use pulse_attach() to associate a pulse code with a function, thus, once the timer timedout, a pulse will send to you, and your function will automaticly called.

Yeah, I am not sure how/where in QNX4 you were creating threads with timer_settime(). QNX4 doesn’t even have threads in any normal sense.

In QNX4, you would have a timer set off a proxy which you would be blocked waiting for. In QNX6, you have it deliever a pulse and do the same thing.


Rick I think he meant “Under QNX6”, and the reference to “does not provide a way to pass a function” is based on the Windows API (not QNX4).

Dispatcher framework should/could have a timer_attach(), that would be nice ;-) Then again it isn’t difficult to write one.