简体   繁体   中英

Difference between thread joinable and detached?

可连接线程和分离线程之间究竟有什么区别?

"Joinable" means that the thread's creator is still responsible for the thread's resources; you must join the thread at some point to wait for the thread to finish (if it hasn't already) and clean up those resources.

"Detached" means that the thread has been made responsible for its own resources, and must not be joined. Do this if you want to let the thread run independently and forget about it.

One can be joined up at a later stage (ie get exit status). The other can carry on its merry way and another thread is unable to find out what it has been up to

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM