Thread exit notification?

Hi,

I would like to find out if there is a signal when a thread exits. In my
process, the parent thread that created the child thread is interested in
knowing when the child thread has exited. I do not want to constantly check
in a loop for the child thread to terminate. I do not want the parent
thread to stay blocked either while the child thread is completing its task.
It might take a while. Is there any form of notification when a thread
exits?

Please help.

Rex

The child thread can specifically raise a signal that the parent will catch.

Bill Caroselli

“Rex Lam” <Rex.Lam@igt.com> wrote in message
news:9lu625$7h2$1@inn.qnx.com

Hi,

I would like to find out if there is a signal when a thread exits. In my
process, the parent thread that created the child thread is interested in
knowing when the child thread has exited. I do not want to constantly
check
in a loop for the child thread to terminate. I do not want the parent
thread to stay blocked either while the child thread is completing its
task.
It might take a while. Is there any form of notification when a thread
exits?

Please help.

Rex

Thank you for the response. But what if the main thread creates a thread
that creates another thread that creates another thread. In this example,
the third thread needs to know that the fourth thread has exited but the
main thread has the signal handler. Is there a notification that the parent
thread receives when its child thread exits? The only way I know of to
synchronize is to use pthread_join or pthread_timedjoin but this blocks the
parent thread. Is there any other way to do this?

Rex


“Bill Caroselli (Q-TPS)” <qtps@earthlink.net> wrote in message
news:9lubep$aga$1@inn.qnx.com

The child thread can specifically raise a signal that the parent will
catch.

Bill Caroselli

“Rex Lam” <> Rex.Lam@igt.com> > wrote in message
news:9lu625$7h2$> 1@inn.qnx.com> …
Hi,

I would like to find out if there is a signal when a thread exits. In
my
process, the parent thread that created the child thread is interested
in
knowing when the child thread has exited. I do not want to constantly
check
in a loop for the child thread to terminate. I do not want the parent
thread to stay blocked either while the child thread is completing its
task.
It might take a while. Is there any form of notification when a thread
exits?

Please help.

Rex
\

Are you looking for an asynchronous method such as signals or maybe a pulse?
Each thread could create a channel, then the child thread could connect to that
and send a pulse upon death.

Rex Lam <Rex.Lam@igt.com> wrote:

Thank you for the response. But what if the main thread creates a thread
that creates another thread that creates another thread. In this example,
the third thread needs to know that the fourth thread has exited but the
main thread has the signal handler. Is there a notification that the parent
thread receives when its child thread exits? The only way I know of to
synchronize is to use pthread_join or pthread_timedjoin but this blocks the
parent thread. Is there any other way to do this?

Rex



“Bill Caroselli (Q-TPS)” <> qtps@earthlink.net> > wrote in message
news:9lubep$aga$> 1@inn.qnx.com> …
The child thread can specifically raise a signal that the parent will
catch.

Bill Caroselli

“Rex Lam” <> Rex.Lam@igt.com> > wrote in message
news:9lu625$7h2$> 1@inn.qnx.com> …
Hi,

I would like to find out if there is a signal when a thread exits. In
my
process, the parent thread that created the child thread is interested
in
knowing when the child thread has exited. I do not want to constantly
check
in a loop for the child thread to terminate. I do not want the parent
thread to stay blocked either while the child thread is completing its
task.
It might take a while. Is there any form of notification when a thread
exits?

Please help.

Rex

\


cburgess@qnx.com

Thanks for the suggestion. This might work.

Rex

“Colin Burgess” <cburgess@qnx.com> wrote in message
news:9ludko$ja9$1@nntp.qnx.com

Are you looking for an asynchronous method such as signals or maybe a
pulse?
Each thread could create a channel, then the child thread could connect to
that
and send a pulse upon death.

Rex Lam <> Rex.Lam@igt.com> > wrote:
Thank you for the response. But what if the main thread creates a
thread
that creates another thread that creates another thread. In this
example,
the third thread needs to know that the fourth thread has exited but the
main thread has the signal handler. Is there a notification that the
parent
thread receives when its child thread exits? The only way I know of to
synchronize is to use pthread_join or pthread_timedjoin but this blocks
the
parent thread. Is there any other way to do this?

Rex


“Bill Caroselli (Q-TPS)” <> qtps@earthlink.net> > wrote in message
news:9lubep$aga$> 1@inn.qnx.com> …
The child thread can specifically raise a signal that the parent will
catch.

Bill Caroselli

“Rex Lam” <> Rex.Lam@igt.com> > wrote in message
news:9lu625$7h2$> 1@inn.qnx.com> …
Hi,

I would like to find out if there is a signal when a thread exits.
In
my
process, the parent thread that created the child thread is
interested
in
knowing when the child thread has exited. I do not want to
constantly
check
in a loop for the child thread to terminate. I do not want the
parent
thread to stay blocked either while the child thread is completing
its
task.
It might take a while. Is there any form of notification when a
thread
exits?

Please help.

Rex






\

cburgess@qnx.com

Rex Lam <Rex.Lam@igt.com> wrote:

Hi,

I would like to find out if there is a signal when a thread exits. In my
process, the parent thread that created the child thread is interested in
knowing when the child thread has exited. I do not want to constantly check
in a loop for the child thread to terminate. I do not want the parent
thread to stay blocked either while the child thread is completing its task.
It might take a while. Is there any form of notification when a thread
exits?

Look at the ChannelCreate() flag _NTO_CHF_THREAD_DEATH

This will ask for a pulse to be sent to the channel anytime a thread
in the process dies.

(Note that only one channel in the process may set this flag, and if
it is a resmgr or a Photon app, that channel may already set it.)

-David

QNX Training Services
dagibbs@qnx.com