32.Linux/Unix 系统编程手册(上) -- 线程:线程取消

1.线程取消	
	有时候需要取消一个线程,即向一个线程发送一个请求,要求其退出。
	pthread_cancel();
	pthread_setcancelstate();
	pthread_setcanceltype();

2.取消点
	若将线程的取消性状态和类型分别置为启用和延迟,仅当线程抵达某个取消点时,取消请求才会起作用。
  取消点即使对由实现定义的一组函数之一加以调用。

    phtread_testcancel();
    pthread_cleanup_push();
    pthread_cleanup_pop();

猜你喜欢

转载自blog.csdn.net/enlyhua/article/details/82929527