Difference between revisions of "Pthread"
From Teknologisk videncenter
m (→Links) |
m (→Links) |
||
Line 5: | Line 5: | ||
=Links= | =Links= | ||
− | *[https:// | + | *[https://www.cs.cmu.edu/afs/cs/academic/class/15492-f07/www/pthreads.html Tutorial on pthreads from Carnegie Mellon University] (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://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf HP - Threads in C - are they safe] |
Revision as of 14:25, 17 December 2022
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