In multiple thread programming,we usual use pthread_cond_wait to wait user specified condition becomes true,
it is true,but when we want to exit this thread,it is blocked because of the false condition because of the function
pthread_cond_wait(),so we must supply a friendly mechnism to exit thread normally.
The following statment is a case that I found in web.In the last,the author metioned three methods,
and 1st and 3st are recommended. In real life,I like use the 3st. I use it in my many projects.
It's perfect!
by zhangshaoyan at May 28,2015.
在多线程编程中,使用pthread_cond_wait等待特定条件变为真时,可能会因条件不满足而阻塞线程,导致无法正常退出。本文介绍了如何避免这一问题,并推荐了两种有效的方法来确保线程能正常退出。
3470

被折叠的 条评论
为什么被折叠?



