thrd_detach()

Updated: May 06, 2022

Detach a thread from a process

Synopsis:

#include <threads.h>

int thrd_detach( thrd_t thr );

Arguments:

thr
The ID of the thread that you want to detach, which you can get when you call thrd_create() or thrd_current().

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The thrd_detach() function detaches the thread with the given ID from its process. When a detached thread terminates, all system resources allocated to that thread are immediately reclaimed.

Returns:

thrd_success
Success.
thrd_error
An error occurred.

Classification:

C11

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