VMS Help POSIX Threads, PTHREAD routines, pthread_cleanup_pop, Description *Conan The Librarian (sorry for the slow response - running on an old VAX) |
This routine removes the cleanup handler routine established by the matching call to pthread_cleanup_push() from the calling thread's cleanup handler stack, then executes it if the value specified in this routine's execute argument is nonzero. A cleanup handler routine can be used to clean up from a block of code whether exited by normal completion, cancelation, or the raising (or reraising) of an exception. The routine is popped from the calling thread's cleanup handler stack and is called with the arg argument (see the description for pthread_cleanup_ push()) when any of the following actions occur: o The thread calls pthread_cleanup_pop() and specifies a nonzero value for the execute argument. o The thread calls pthread_exit(). o The thread is canceled. o An exception is raised and is caught when the Threads Library unwinds the calling thread's stack to the lexical scope of the pthread_cleanup_push() and pthread_cleanup_pop() pair. This routine and pthread_cleanup_push() are implemented as macros and must appear 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 (}). This routine and pthread_cleanup_push() are implemented as exceptions, and may not work in a C++ environment. (See <REFERENCE>(exceptions_chap) for more information.)
|