pthread_cleanup_pop(3thr)
Name
pthread_cleanup_pop − Removes the cleanup handler at the top of the cleanup stack and optionally executes it.
Syntax
#include <pthread.h>
int pthread_cleanup_pop (execute)
int execute;
Arguments
execute Integer that specifies whether the cleanup routine in pthread_cleanup_push is executed when the thread terminates normally (for example, when pthread_exit is called). If the value of execute is 0, the routine is executed only if the thread terminates abnormally (for example, if the thread is canceled). If the value is 1 or more, the routine is executed regardless of whether the thread terminates normally or abnormally.
Description
This routine removes the routine specified in pthread_cleanup_push at the top of the calling thread’s cleanup stack and executes it if the value specified in execute is nonzero.
This routine and pthread_cleanup_push are implemented as macros and must appear as statements and in pairs within the same lexical scope. You can think of the pthread_cleanup_push macro as expanding to a string whose first character is a left curly brace ({) and pthread_cleanup_pop expanding to a string containing the corresponding right curly brace (}).
Return Values
This routine must be used as a statement.
If an error is detected, it may be indicated by sending the thread a synchronously generated signal.