Difference between revisions of "Pthread"
From Teknologisk videncenter
m (→Releasing ressources used by a pthread) |
m (→Links) |
||
Line 7: | Line 7: | ||
*[https://computing.llnl.gov/tutorials/pthreads/ Tutorial on pthreads from Lawrence Livermore National Laboratory] (Good) | *[https://computing.llnl.gov/tutorials/pthreads/ Tutorial on pthreads from Lawrence Livermore National Laboratory] (Good) | ||
*[https://www.yangyang.cloud/blog/2018/11/09/worker-pool-with-eventfd/ Pthread example: Worker poll with eventfd] | *[https://www.yangyang.cloud/blog/2018/11/09/worker-pool-with-eventfd/ Pthread example: Worker poll with eventfd] | ||
+ | *[https://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf HP - Threads in C - are they safe] | ||
+ | *[https://elinux.org/images/1/1c/Ben-Yossef-GoodBadUgly.pdf Pthreads PPT] | ||
+ | |||
+ | |||
[[Category:C]][[Category:Linux]] | [[Category:C]][[Category:Linux]] |
Revision as of 10:39, 6 February 2021
Releasing resources used by a pthread
To release the resources - memory for stack and householding - it is necessary to call either pthread_detach or pthread_join. The resources are not released when the pthread exits without one of these calls.
- pthread_join is called by the process or another thread.
- pthread_detach is typically called by the thread itself to release the resources when the thread terminates