Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_cleanup_pop(3) [osx man page]

PTHREAD_CLEANUP_POP(3)					   BSD Library Functions Manual 				    PTHREAD_CLEANUP_POP(3)

NAME
pthread_cleanup_pop -- call the first cleanup routine SYNOPSIS
#include <pthread.h> void pthread_cleanup_pop(int execute); DESCRIPTION
The pthread_cleanup_pop() function pops the top cleanup routine off of the current thread's cleanup routine stack and, if execute is non- zero, it will execute the function. If there is no cleanup routine, pthread_cleanup_pop() does nothing. pthread_cleanup_pop() must be paired with a corresponding pthread_cleanup_push(3) in the same lexical scope. RETURN VALUES
pthread_cleanup_pop() does not return any value. ERRORS
None SEE ALSO
pthread_cleanup_push(3), pthread_exit(3) STANDARDS
pthread_cleanup_pop() conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). BSD
July 30, 1998 BSD

Check Out this Related Man Page

PTHREAD_CLEANUP(3)					   BSD Library Functions Manual 					PTHREAD_CLEANUP(3)

NAME
pthread_cleanup_push, pthread_cleanup_pop -- add and remove cleanup functions for thread exit LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> void pthread_cleanup_push(void (*cleanup_routine)(void *), void *arg); void pthread_cleanup_pop(int execute); DESCRIPTION
The pthread_cleanup_push() function adds cleanup_routine to the top of the stack of cleanup handlers that get called when the current thread exits. The pthread_cleanup_pop() function pops the top cleanup routine off of the current threads cleanup routine stack, and, if execute is non- zero, it will execute the function. When cleanup_routine is called, it is passed arg as its only argument. These functions may be implemented as macros which contain scope delimiters; therefore, there must be a matching pthread_cleanup_pop() for every pthread_cleanup_push() at the same level of lexical scoping. The effect of calling longjmp() or siglongjmp() is undefined after a call to pthread_cleanup_push() but before the matching call to pthread_cleanup_pop() after the jump buffer was filled. RETURN VALUES
Neither pthread_cleanup_push() nor pthread_cleanup_pop() returns a value. ERRORS
None. SEE ALSO
pthread_exit(3) STANDARDS
Both functions conform to IEEE Std 1003.1-2001 (``POSIX.1''). BSD
July 9, 2010 BSD
Man Page

6 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

threads and memory allocation

Hello! First of all, forgive me for bad English. When I starts new thread (pthread_create), system allocates some memory for it (for example, for thread's stack). I wonder when does it deallocate this memory? The problem is that I have a program which sometimes creates new threads and sometimes... (3 Replies)
Discussion started by: prankster
3 Replies

2. Programming

help me out with my threaded c++ mudbase - c++, pthread_cond_wait

hello, in my free time i am writing on a c++ mud codebase, a while ago i decided that i would move to pthreads, so i could make use of smp. now i have a problem which i just cant fix - for weeks now. i have a main thread which spawns my threads, as soon as spawned they get a pthread_cond_wait, so... (4 Replies)
Discussion started by: sonicx
4 Replies

3. AIX

Purified binary is not leaking

Hi, I am working on a project which uses 64-bit capability of AIX. This is very recently ported to 64-bit and leaking like anything now. I purified the program on 64-bit and ran it, purify is not showing any leak. Even memory usage has become very normal in purified binary compared to my... (2 Replies)
Discussion started by: jeet_xp
2 Replies

4. Programming

pthread_cleanup_push/pop - cleanup handler problem

void cleanUp_delete(void * p) { delete p; p = NULL; cout << "cleanUp_delete" << endl; } void connectionReader(void *thread,void*arg) { connection* c = (connection*) arg; pthread_cleanup_push(cleanUp_delete,(void*)c); int bytes; char *buffer = new (char );... (2 Replies)
Discussion started by: sonicx
2 Replies

5. UNIX for Advanced & Expert Users

User defined stacks for threads using glibc-2.3.5

Hi, I am currently working with threads using linux 2.6.11 and glibc 2.3.5 on x86. When i am trying to create thread with user defined stacks glibc gives segmentation fault. I have written a wrapper to pthread_create () and generated shared object for the same. When i am trying to create any... (6 Replies)
Discussion started by: mysterious
6 Replies

6. Programming

Mutex lock question

Hi all, I have a scenario where I need to use the mutex locks. The mutex locks are working fine, but sometimes I am getting into the dead lock situation. Below is the summary of my code : MUTEX LOCK performTask(); MUTEX UNLOCK. In some cases I get into the situation where... (2 Replies)
Discussion started by: cjjoy
2 Replies