pthread_cleanup_push(3-thr) pthread_cleanup_push(3-thr)
NAME
pthreadcleanuppush - establishes a cleanup handler
SYNOPSIS
#include <pthread.h>
void pthreadcleanuppush(
void routine,
pthreadaddrt arg);
PARAMETERS
routine Routine executed as the cleanup handler.
arg Parameter executed with the cleanup routine.
DESCRIPTION
The pthreadcleanuppush() 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 follow-
ing actions occur:
- The thread calls pthreadexit().
- The thread is canceled.
- The thread calls pthreadcleanuppop() and specifies a nonzero
value for the execute parameter.
This routine and pthreadcleanuppop() are implemented as macros and
must be displayed as statements and in pairs within the same lexical
scope. You can think of the pthreadcleanuppush() macro as expanding
to a string whose first character is a { (left brace) and
pthreadcleanuppop() as expanding to a string containing the corre-
sponding } (right brace).
RETURN VALUES
This routine must be used as a statement.
SEE ALSO
pthreadcancel(3-thr), pthreadcleanuppop(3-thr),
pthreadexit(3-thr), pthreadtestcancel(3-thr).
Page 1 Reliant UNIX 5.44 Printed 11/98