pthread_cleanup_push() pushes the specified cancellation cleanup handler routine, handler, onto the cancellation cleanup stack of the calling thread.
When a thread exits or is canceled and its cancellation cleanup stack is not empty, the cleanup handlers are invoked with the argument arg in last in, first out (LIFO)
order from the cancellation cleanup stack.
The Solaris system generates a compile time error if pthread_cleanup_push() does not have a matching pthread_cleanup_pop().
Be aware that using longjmp() or siglongjmp() to jump into or out of a push/pop pair can lead to trouble, as either the matching push or the matching pop statement
might not get executed.
|