Open System Services System Calls Reference Manual (G06.25+, H06.03+)

pthread_cleanup_pop(2) OSS System Calls Ref
erence Manual
NAME
pthread_cleanup_pop - (Macro) Removes the cleanup-handler routine from the calling thread
s
cleanup-handler stack and optionally executes it
LIBRARY
None. This application program interface is implemented as a macro.
SYNOPSIS
#include <spthread.h>
void pthread_cleanup_pop(
int execute );
PARAMETERS
execute controls whether the cleanup-handler routine speci
ed in the matching call to
pthread_cleanup_push()
is executed. If execute is nonzero, the cleanup-
handler routine executes.
DESCRIPTION
This macro removes the cleanup-handler routine established by the matching call to
pthread_cleanup_push() from the calling threads cleanup-handler stack, then executes it if the
value of execute is nonzero.
A cleanup-handler routine can be used to clean up from a block of code whether the code is
exited by normal completion, cancelation, or the raising (or reraising) of an exception. The rou-
tine is popped from the calling threads cleanup-handler stack and is executed with its arg
parameter when any of the following actions occur:
The thread calls pthread_cleanup_pop( ) and species a nonzero value for the execute
parameter.
The thread calls pthread_exit().
The thread is canceled.
An exception is raised and is caught when the system unwinds the calling threads stack
to the lexical scope of the pthread_cleanup_push() and pthread_cleanup_pop( ) mac-
ros.
This macro and pthread_cleanup_push( ) must appear in pairs within the same lexical scope.
RELATED INFORMATION
Functions: pthread_cancel(2), pthread_cleanup_push(2), pthread_create(2),
pthread_exit(2).
STANDARDS CONFORMANCE
This macro is an extension to the XPG4 Version 2 specication. Interfaces documented on this
reference page conform to the following industry standards:
IEEE Std 1003.1c-1995, POSIX System Application Program Interface
The use of the header le spthread.h is an HP exception to the POSIX standard.
540 Hewlett-Packard Company 527186-003