Converts a joinable thread to a detached (non-joinable) thread.
#include <nks/thread.h> int NXThreadDetach ( NXThreadId_t tid);
(IN) Specifies the ID of the thread to convert to a detached thread.
If successful, returns 0; otherwise, returns a nonzero error code:
If successful, NXThreadDetach converts the joinable thread specified by the tid parameter to a detached thread. Such a thread can no longer be joined using the NXThreadJoin function.
If a thread has already called NXThreadJoin for the thread being detached, the thread returns from NXThreadJoin with an error indicating that the thread being joined was not joinable.If the thread being detached has already exited and is waiting for a join operation, it will be cleaned up immediately. The thread cannot be subsequently joined using NXThreadJoin.
The use of NXThreadDetach is strongly discouraged and is provided only to support porting code written to other threads libraries, notably pthreads.
NXThreadDetach can be called by a thread for itself, but tid has to be obtained by calling NXThreadGetId.