Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ pthread_cleanup_push(3T) — SunOS 5.6

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

cancellation(3T)

condition(3T)

longjmp(3C)

pthread_cancel(3T)

pthread_cleanup_pop(3T)

pthread_exit(3T)

pthread_join(3T)

pthread_setcancelstate(3T)

pthread_setcanceltype(3T)

pthread_testcancel(3T)

attributes(5)

pthread_cleanup_push(3T)

NAME

pthread_cleanup_push − push a thread cancellation cleanup handler

SYNOPSIS

#include <pthread.h>

void pthread_cleanup_push(void (∗ handler void ∗) void ∗ arg );

MT-LEVEL

MT-Safe

DESCRIPTION

pthread_cleanup_push(3T) 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 LIFO order from the cancellation cleanup stack. 

When the thread calls pthread_cleanup_pop(3T) with a non-zero execute argument, the argument at the top of the stack is popped and executed.  When the thread calls pthread_cleanup_pop(3T) with a zero execute argument, the argument at the top of the stack is popped but not executed. 

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

Be aware that using longjmp(3C) 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

pthread_cleanup_push(3T) is a statement and does not return anything. 

ATTRIBUTES

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

ATTRIBUTE TYPE ATTRIBUTE VALUE
MT-Level MT-Safe

SEE ALSO

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

NOTES

See the cancellation(3T) page for a discussion of cancellation concepts. 

SunOS 5.6  —  Last change: 7 Jan 1997

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