【发布时间】:2011-06-22 09:56:40
【问题描述】:
我有一些代码,大致如下:
pthread_create(thread_timeout, NULL, handleTimeOut, NULL);
void handleTimeOut()
{
/*...*/
pthread_cancel(thread_timeout);
/*...*/
}
但正如我在 pthread 的手册中注意到的,取消必须由另一个线程使用。我尝试改用 pthread_exit() 函数,但这个线程再次挂起......
必须如何正确处理胎面终止?如果函数handleTimeOut()在没有特殊pthread函数的情况下刚刚结束,是否会成功终止?
【问题讨论】: