Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 8
Detach a thread from a process
#include <sys/neutrino.h>
int ThreadDetach( int tid );
int ThreadDetach_r( int tid );
- tid
- The ID of the thread that you want to detach, as returned by
ThreadCreate(),
or 0 to detach the current thread.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
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.
The ThreadDetach() and ThreadDetach_r()
functions are identical, except in the way they indicate errors.
See the Returns section for details.
|
Instead of using these kernel calls directly, consider calling
pthread_detach(). |
These calls don't block.
The only difference between these functions is the way they indicate errors:
- ThreadDetach()
- If an error occurs, the function returns -1 and sets
errno.
Any other value returned indicates success.
- ThreadDetach_r()
- Returns EOK on success.
This function does NOT set errno.
If an error occurs, the function can return any value listed in the Errors
section.
- EINVAL
- The thread is already detached.
- ESRCH
- The thread indicated by tid doesn't exist.
QNX Neutrino
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
pthread_detach(),
ThreadCreate(),
ThreadJoin()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 170
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/threaddetach.html on line 170