Use pthread_cleanup_pop(3T) to pull the cleanup handler off the cleanup stack.
A nonzero argument in the pop function removes the handler from the stack and executes it. An argument of zero pops the handler without executing it.
pthread_cleanup_pop() is effectively called with a nonzero argument if a thread either explicitly or implicitly calls pthread_exit(3T) or if the thread accepts a cancel request.
Prototype: 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);
There are no return values.