pthread_cleanup_pop(3) — Subroutines
Digital
NAME
pthread_cleanup_pop − Removes the cleanup handler at the top of the cleanup stack and optionally executes it.
SYNOPSIS
#include <pthread.h>
void pthread_cleanup_pop(
int execute );
PARAMETERS
executeInteger 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 cancelled). 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 be displayed 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 brace ({) and pthread_cleanup_pop expanding to a string containing the corresponding right 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.