📄 pthread_detach.man
字号:
.TH PTHREAD_DETACH 3 LinuxThreads.SH NAMEpthread_detach \- put a running thread in the detached state.SH SYNOPSIS#include <pthread.h>int pthread_detach(pthread_t th);.SH DESCRIPTION!pthread_detach! put the thread |th| in the detached state. Thisguarantees that the memory resources consumed by |th| will be freedimmediately when |th| terminates. However, this prevents other threadsfrom synchronizing on the termination of |th| using !pthread_join!.A thread can be created initially in the detached state, using the!detachstate! attribute to !pthread_create!(3). In contrast,!pthread_detach! applies to threads created in the joinable state, andwhich need to be put in the detached state later.After !pthread_detach! completes, subsequent attempts to perform!pthread_join! on |th| will fail. If another thread is already joiningthe thread |th| at the time !pthread_detach! is called,!pthread_detach! does nothing and leaves |th| in the joinable state..SH "RETURN VALUE"On success, 0 is returned. On error, a non-zero error code is returned..SH ERRORS.TP!ESRCH!No thread could be found corresponding to that specified by |th|.TP!EINVAL!the thread |th| is already in the detached state.SH AUTHORXavier Leroy <Xavier.Leroy@inria.fr>.SH "SEE ALSO"!pthread_create!(3),!pthread_join!(3),!pthread_attr_setdetachstate!(3).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -