/sys$common/syshlp/HELPLIB.HLB  —  POSIX Threads, PTHREAD routines, pthread_cleanup_pop
    (Macro) Removes the cleanup handler routine from the calling
    thread's cleanup handler stack and optionally executes it.

1  –  C Binding

    #include <pthread.h>

    void
    pthread_cleanup_pop(
             int   execute);

2  –  Arguments

 execute

    Integer that specifies whether the cleanup handler routine
    specified in the matching call to pthread_cleanup_push() is
    executed. A nonzero value causes the cleanup handler routine
    to be executed.

3  –  Description

    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.)

4  –  Return Values

    None

5  –  Associated Routines

       pthread_cancel()
       pthread_cleanup_push()
       pthread_create()
       pthread_exit()
Close Help