VMS Help
POSIX Threads, PTHREAD routines, pthread_cleanup_push
*Conan The Librarian (sorry for the slow response - running on an old VAX)
|
|
(Macro) Establishes a cleanup handler routine to be executed when
the thread exits or is canceled.
#include <phtread.h>
void
pthread_cleanup_push(
void (*routine)(void *),
void *arg);
routine
Routine executed as the cleanup handler.
arg
Argument passed to the cleanup handler routine.
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.)
None
pthread_cancel()
pthread_cleanup_pop()
pthread_create()
pthread_exit()
pthread_testcancel()
[legal]
[privacy]
[GNU]
[policy]
[netiquette]
[sponsors]
[FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.