Signals and fork and _beginthread

QNX 4.25E

(1) Do signals handlers installed in a thread (_beginthread) overwrite the
signals handlers of the parent (the parent wants to igorne SIGHUP but then
the thread wants to exit on SIGHUP)?

(2) Do signal handlers installed in a forked process overwite the signal
handlers of the parent?

(3) Is this the same behavior in QNX6?

  • Richard

Richard Brown <brownr@aecl.ca> wrote:

QNX 4.25E

(1) Do signals handlers installed in a thread (_beginthread) overwrite the
signals handlers of the parent (the parent wants to igorne SIGHUP but then
the thread wants to exit on SIGHUP)?

Since a “thread” in QNX4 is really a process, each can handle signals independantly.

(2) Do signal handlers installed in a forked process overwite the signal
handlers of the parent?

You can change the sigmask, or the handlers in a new process.

(3) Is this the same behavior in QNX6?

Fork()'d processes behave the same way with signals, but threads do exist
(for real) in QNX6. Therefore since signals are applied to a process,
any thread (with some exceptions with syncronous signals) could be in context
when the process is hit with a signal. You should set the signal mask
with pthread_sigmask so all threads ignore all signals, except one thread.
This way, you know which thread will get hit with the signal.

-Adam

Operating System for Tech Supp <os@qnx.com> wrote:

Since a “thread” in QNX4 is really a process, each can handle signals independantly.

I should correct myself, setting the signal mask can be done on a thread by thread
basis, but setting the signal handler is a global setting to the process (and its
threads) as a whole.

Sorry about the confusion.

Adam

Thanks,

I was going to say something after your first response but then I began
questioning myself. I went back and created a test and found signal handling
to be as you mention here.

  • Richard

“Operating System for Tech Supp” <os@qnx.com> wrote in message
news:9pko1a$n78$1@nntp.qnx.com

Operating System for Tech Supp <> os@qnx.com> > wrote:

Since a “thread” in QNX4 is really a process, each can handle signals
independantly.

I should correct myself, setting the signal mask can be done on a thread
by thread
basis, but setting the signal handler is a global setting to the process
(and its
threads) as a whole.

Sorry about the confusion.

Adam