多线程编程指南

从栈中弹出处理程序

请使用 pthread_cleanup_pop(3C) 从清理栈中弹出清理处理程序。

pthread_cleanup_pop 语法

void pthread_cleanup_pop(int execute);
#include <pthread.h>



/* pop the "func" out of cleanup stack and execute "func" */

pthread_cleanup_pop (1);



/* pop the "func" and DONT execute "func" */

pthread_cleanup_pop (0); 

如果弹出函数中的参数为非零值,则会从栈中删除该处理程序并执行该处理程序。如果该参数为零,则会弹出该处理程序,而不执行它。

线程显式或隐式调用 pthread_exit(3C) 时,或线程接受取消请求时,会使用非零参数有效地调用 pthread_cleanup_pop()

pthread_cleanup_pop 返回值

pthread_cleanup_pop() 没有返回值。