Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

pthread_cancel(3P)

pthread_setcancel(3P)

PTHREAD_CLEANUP_PUSH(3P)             SysV             PTHREAD_CLEANUP_PUSH(3P)



NAME
     pthread_cleanup_push - Pushes a routine onto the cleanup stack of the
     calling thread

SYNOPSIS
     #include <pthread.h>

     void pthread_cleanup_push (routine, arg)
     void (*routine)(void *arg);
     void *arg;

DESCRIPTION
     The pthread_cleanup_push function pushes the specified routine onto the
     calling thread's cleanup stack.

     routine specifies the routine to push on the calling thread's cleanup
     stack; and arg specifies the single argument to be passed to the cleanup
     routine.

     Each thread maintains a list of cleanup routines.  The
     pthread_cleanup_push function is used to place routines on the list, and
     the pthread_cleanup_pop(3P) function is used to remove routines from the
     list.

     A cleanup routine will be popped from the stack and executed with the arg
     argument when one of the following occurs:

     +  The thread exits.

     +  The thread is canceled.

     +  The thread calls the pthread_cleanup_pop(3P) function with a nonzero
        execute argument.

     Every call to the pthread_cleanup_push function must be matched by
     exactly one call to the pthread_cleanup_pop(3P) function at the same
     lexical level as the push.

     The effect of calling the longjmp(3C) argument or executing a return or
     goto after a call to the pthread_cleanup_push function but before the
     matching call to the pthread_cleanup_pop(3P) function is unspecified.
     The effect of calling the longjmp(3C) argument from a cleanup routine is
     also unspecified.

NOTES
     This interface is based on draft 4 of the IEEE P1003.4a standard, and
     will be changed to conform to the final version.

DIAGNOSTICS
     No value is returned.

SEE ALSO
     pthread_cancel(3P), pthread_setcancel(3P)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026