[Previous] [Contents] [Next]

ThreadDetach(), ThreadDetach_r()

Detach a thread from a process

Synopsis:

#include <sys/neutrino.h>

int ThreadDetach( int tid );

int ThreadDetach_r( int tid );

Library:

libc

Description:

The ThreadDetach() and ThreadDetach_r() functions are identical except in the way they indicate errors. See the Returns section for details.

These kernel calls detach the thread specified by tid. If tid is zero, the calling thread is used. Once detached, attempts to call ThreadJoin() on tid fail. When a detached thread terminates, its termination status is discarded and all its resources are released.

Blocking states

These calls don't block.

Returns:

The only difference between these functions is the way they indicate errors:

ThreadDetach()
If an error occurs, -1 is returned and errno is set. Any other value returned indicates success.
ThreadDetach_r()
EOK is returned on success. This function does NOT set errno. If an error occurs, any value in the Errors section may be returned.

Errors:

EINVAL
The thread is already detached.
ESRCH
The thread indicated by tid doesn't exist.

Classification:

QNX 6

Safety:
Cancellation point No
Interrupt handler No
Signal handler Yes
Thread Yes

See also:

ThreadJoin()


[Previous] [Contents] [Next]