pthread_cleanup_pop(3T)
NAME
pthread_cleanup_pop − pop a thread cancellation cleanup handler
SYNOPSIS
#include <pthread.h>
void pthread_cleanup_pop(int execute );
MT-LEVEL
MT-Safe
DESCRIPTION
pthread_cleanup_pop() removes the cleanup handler routine at the top of the cancellation cleanup stack of the calling thread and executes it if execute is non-zero.
When a thread exits or is canceled and its cancellation cleanup stack is not empty, the cleanup handlers are invoked with the pthread_cleanup_push(3T) argument arg in LIFO order from the cancellation cleanup stack.
When the thread calls pthread_cleanup_pop() with a non-zero execute argument, the argument at the top of the stack is popped and executed. An argument of zero pops the handler without executing it.
The Solaris system generates a compile time error if pthread_cleanup_push() does not have a matching pthread-cleanup_pop().
Be aware that using longjmp() or siglongjmp() to jump into or out of a push/pop pair can lead to trouble, as either the matching push or the matching pop statement might not get executed.
RETURN VALUES
pthread_cleanup_pop() is a statement and does not return anything.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
| MT-Level | MT-Safe |
SEE ALSO
cancellation(3T), condition(3T), pthread_cancel(3T), pthread_cleanup_push(3T), pthread_exit(3T), pthread_join(3T), pthread_setcancelstate(3T), pthread_setcanceltype(3T), pthread_testcancel(3T), setjmp(3C), attributes(5)
NOTES
See cancellation(3T) for a discussion of cancellation concepts.
SunOS 5.6 — Last change: 7 Jan 1997