Sun Microsystems, Inc.
spacerspacer
spacer   www.sun.com docs.sun.com | | |  
spacer
black dot
   
A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q   R   S   T   U   V   W   X   Y   Z
    
 
Threads Library Functionspthread_cleanup_push(3THR)


NAME

 pthread_cleanup_push - push a thread cancellation cleanup handler

SYNOPSIS

 
cc -mt [ flag... ] file... -lpthread [ -lrt library... ]
#include <pthread.h>
void pthread_cleanup_push(void (*handler, void *),void *arg);

DESCRIPTION

 

pthread_cleanup_push() pushes the specified cancellation cleanup handler routine, handler, onto the cancellation cleanup stack of the calling thread.

When a thread exits or is canceled and its cancellation cleanup stack is not empty, the cleanup handlers are invoked with the argument arg in last in, first out (LIFO) order from the cancellation cleanup stack.

The Solaris system generates a compile time error if pthread_cleanup_push() does not have a matching pthread_cleanup_pop().

Be aware that using longjmp() or siglongjmp() to jump into or out of a push/pop pair can lead to trouble, as either the matching push or the matching pop statement might not get executed.

RETURN VALUES

 

The pthread_cleanup_push() function returns no value.

ERRORS

 

No errors are defined.

The pthread_cleanup_push() function will not return an error code of EINTR.

ATTRIBUTES

 

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPEATTRIBUTE VALUE
MT-LevelMT-Safe

SEE ALSO

 

cancellation(3THR), condition(3THR), longjmp(3C), pthread_cancel(3THR), pthread_cleanup_pop(3THR), pthread_exit(3THR), pthread_join(3THR), pthread_setcancelstate(3THR), pthread_setcanceltype(3THR), pthread_testcancel(3THR), attributes(5)

NOTES

 

See cancellation(3THR) for a discussion of cancellation concepts.


SunOS 5.9Go To TopLast Changed 28 Apr 1998

 
      
      
Copyright 2002 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.