Thread termination notification

If a thread within a process gets terminated (exits normally, or cancelled
or crashed), will the process be notified? Where I can find the document for
this aspect?

Thanks.

Xuedong

Thanks.

Xuedong
“Operating System Tech Support” <os@qnx.com> wrote in message
news:9tb5n8$7f4$1@nntp.qnx.com

“Xuedong Chen” <> Xuedong.Chen@IGT.com> > wrote in message
news:9t9p3i$il9$> 1@inn.qnx.com> …
If a thread within a process gets terminated (exits normally, or
cancelled
or crashed), will the process be notified? Where I can find the document
for
this aspect?

The process won’t be notified when a thread ends. To detect if a thread
has
completed you can (POSIX threads assumed) do a pthread_join() which will
block until the specified thread exits. Or you could register a cleanup
handler by calling pthread_cleanup_push() to push a handler that cleans up
(and notifies the process) the thread that died (don’t forget to call
pthread_cleanup_pop()).

-Adam

“Xuedong Chen” <Xuedong.Chen@IGT.com> wrote in message
news:9t9p3i$il9$1@inn.qnx.com

If a thread within a process gets terminated (exits normally, or cancelled
or crashed), will the process be notified? Where I can find the document
for
this aspect?

The process won’t be notified when a thread ends. To detect if a thread has
completed you can (POSIX threads assumed) do a pthread_join() which will
block until the specified thread exits. Or you could register a cleanup
handler by calling pthread_cleanup_push() to push a handler that cleans up
(and notifies the process) the thread that died (don’t forget to call
pthread_cleanup_pop()).

-Adam

Xuedong Chen <Xuedong.Chen@igt.com> wrote:

If a thread within a process gets terminated (exits normally, or cancelled
or crashed), will the process be notified? Where I can find the document for
this aspect?

There is no Posix way to do this.

But, if you create a Channel with the flag _NTO_CHF_THREAD_DEATH you will
get a pulse whenever a thread dies – check the docs for ChannelCreate()
for more details on what the pulse looks like, etc.

-David

QNX Training Services
I do not answer technical questions by email.