![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线程
大西瓜-PaulChan
成功=机遇+基础+兴趣!
展开
-
线程可能终止方式
一.线程终止方式 return 从启动例程中返回,返回值就是线程的退出码。进程中的其它线程可通过 pthread_join 函数获取这个返回值。 void pthread_exit(void *rval_ptr); 退出线程,进程中的其它线程可通过 pthread_join 函数访问到 rval_ptr 这个指针。 exit 、_Exit 或 _exit 。进程中的任一线程调用该转载 2016-09-30 20:26:20 · 185 阅读 · 0 评论 -
剖析pthread_cancel()
一.简述 int pthread_cancel(pthread_t tid); 请求同一进程中的其它线程退出。要注意的是,该函数并不等待线程终止,他仅仅提出请求。调用了该函数也不等于目标线程马上就会退出,目标线程有可能再运行一段时间后到达取消点才退出;甚至有可能不响应退出。 二.基本用法_pthread_cancel 请求退出 #include #include #inc转载 2016-09-30 20:36:45 · 520 阅读 · 0 评论