linux多线程编程的两个知识点
对pthread_cleanup_push和pthread_cleanup_pop不怎么理解,大虾们帮我解释具体解释一下,如果能有个简单的例子就更好了!
[解决办法]
记错了,,pthread_kill是发送信号的,,
应该是pthread_cancel.
int pthread_cancel(pthread_t thread);
When a cancellation requested is acted on, the following steps occur
for thread (in this order):
1. Cancellation clean-up handlers are popped (in the reverse of the
order in which they were pushed) and called. (See
pthread_cleanup_push(3).)
2. Thread-specific data destructors are called, in an unspecified
order. (See pthread_key_create(3).)
3. The thread is terminated. (See pthread_exit(3).)
[解决办法]