SA_RESTART solution?

Hello!

Since SA_RESTART is not supported with QNX6.
I there a way to configure a task for acting as if SA_RESTART was set.
At the moment, each system call in my app is encapsulated in a loop and,
while the status is EINTR I retry.

ex:

while( TheSysCall(…) == EINTR);

Is there a smarter way?

Thanks

Vincent

Vincent <vincent.catros_NO_SPAM_@bigfoot.com> wrote:

Hello!

Since SA_RESTART is not supported with QNX6.
I there a way to configure a task for acting as if SA_RESTART was set.
At the moment, each system call in my app is encapsulated in a loop and,
while the status is EINTR I retry.

ex:

while( TheSysCall(…) == EINTR);

Is there a smarter way?

Does this thread NEED to get signals?

A common way of dealing with signals in QNX6:
– create a signal handler thread
– mask all the signals in all the threads but the signal handler one.
– wait for signals in the signal handler thread – sigwaitinfo()
(in fact, even the signal handler thread can have signals masked so it
doesn’t have to test for EINTR on anything, as sigwaitinfo() unmasks
signals only while blocked & waiting for signals which is quite convenient)
and handle the signals in that signal handling thread.

If some particular work needs to be done due to a signal (e.g. re-read a
configuration file ala inetd and SIGHUP), then the signal handler has to
let the main thread know… it can send a pulse, post a semaphore or
whatever method fits the architecture of the main process.

-David

QNX Training Services
dagibbs@qnx.com

David Gibbs wrote:

Vincent <> vincent.catros_NO_SPAM_@bigfoot.com> > wrote:
Hello!

Since SA_RESTART is not supported with QNX6.
I there a way to configure a task for acting as if SA_RESTART was set.
At the moment, each system call in my app is encapsulated in a loop and,
while the status is EINTR I retry.

ex:

while( TheSysCall(…) == EINTR);

Is there a smarter way?

Does this thread NEED to get signals?

A common way of dealing with signals in QNX6:
– create a signal handler thread
– mask all the signals in all the threads but the signal handler one.
– wait for signals in the signal handler thread – sigwaitinfo()

Yes, and it is not QNX6-specific way. It is POSIX way and we use it in
Solaris.
It can be little tricky to get right though.

  • igor

Thank you David for your answer.

But, unfortunatly I DO NEED this threads to handle signals.

Vincent