I need to develop a cyclic executive. Currently i’m using a real time timer created with timer_create().
I have seen in the examples in the QNX Neutrino library reference that the timer firing is associated to a pulse, however, i want to use the default SIGALRM signal generated by the timer with the handler installed by signalaction() or waiting the event using sigwait().
My doubt is: this could work? should i use a SIGUSRX signal instead?
Hum… I’m not sure but I think when the signal arise to your program, your handler catch it and call to some function (?), so that signal is masked to avoid nested signals and if someone send a signal of the same type (number) again it’s enqueued, so when you return from your handler the signal is unmasked, so if there is a pending signal you will catch it again…
Pulses are also enqueued if the receiver isn’t blocked waiting for it… !!! You have to take care of that types of things…
The main reason to use a timer with pulses or signals, as I understand, is that pulses needs a MsgReceive() or MsgReceivePulse() in main loop and your pulse will be distingished at that point, while sending periodics signal needs a handler that catch them interrupting the normal execution sequence.
It’s all about what do you need. If your process already have a MsgReceive in main loop, and you need just to distingish if a pulse or an outside msg you can do something like:
while ( FOR_EVER )
{
rcvid = MsgReceive (chid, …)
{
if (rcvid == 0)
{
// you got a pulse
}
else
{
// you a got a message
}
}
}