Index of Section 2 Manual Pages
| Interix / SUA | pthread_cleanup_pop.2 | Interix / SUA |
pthread_cleanup_pop(2) pthread_cleanup_pop(2)
pthread_cleanup_pop()
NAME
pthread_cleanup_pop(), pthread_cleanup_push() - establish and execute a
thread's cleanup handlers
SYNOPSIS
#include
void pthread_cleanup_pop(int execute);
void pthread_cleanup_push(void (*routine)(void*), void *arg);
DESCRIPTION
The pthread_cleanup_push(2) macro pushes the cleanup handler macro
referenced by routine onto the calling thread's cancellation cleanup
stack. If the specified macro is at the top of the stack, it is popped
from the stack and executed with the argument referenced by arg under the
following circumstances:
* When the thread exits (that is, pthread_exit(2) is called for the
thread)
* The thread responds to a cancellation request (that is,
pthread_cancel() is called for the thread)
* The thread calls pthread_cleanup_pop() with the execute argument set
to a value other than 0.
The pthread_cleanup_pop(2) macro removes the routine at the top of the
calling thread's cancellation cleanup stack and, if execute is non-zero,
calls it.
Applications must ensure that pthread_cleanup_push() and
pthread_cleanup_pop() are called in pairs within the same lexical scope.
RETURN VALUES
None.
ERRORS
None.
SEE ALSO
pthread_cancel(2)
pthread_setcancelstate(2)
USAGE NOTES
All of these macros are thread safe.
None of these macros are async-signal safe.