This routine pushes the specified routine onto the calling thread's cleanup handler stack. The cleanup handler routine is popped from the stack and called with the arg argument 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_pop() 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_pop() are implemented as exceptions, and may not work in a C++ environment. (See <REFERENCE>(exceptions_chap) for more information.)