pthread_cleanup_push(3)
NAME
pthread_cleanup_push - Establishes a cleanup handler
SYNOPSIS
#include <pthread.h> void pthread_cleanup_push( void routine, pthread_addr_t arg);
PARAMETERS
routineRoutine executed as the cleanup handler.
argParameter executed with the cleanup routine.
DESCRIPTION
The pthread_cleanup_push() routine pushes the specified routine onto the calling thread’s cleanup stack. The cleanup routine is popped from the stack and executed with the arg parameter when any of the following actions occur:
•The thread calls pthread_exit().
•The thread is canceled.
•The thread calls pthread_cleanup_pop() and specifies a nonzero value for the execute parameter.
This routine and pthread_cleanup_pop() 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() as expanding to a string containing the corresponding } (right brace).
RETURN VALUES
This routine must be used as a statement.
RELATED INFORMATION
Functions: pthread_cancel(3), pthread_cleanup_pop(3), pthread_exit(3), pthread_testcancel(3).
Hewlett-Packard Company — OSF DCE 1.1/HP DCE 1.5