Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

pthread_cleanup_pop(3) [mojave 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 threads cleanup routine stack, and, if execute is non- zero, it will execute the function. If there is no cleanup routine then pthread_cleanup_pop() does nothing. The pthread_cleanup_pop() function is implemented as a macro that closes a block. Invocations of this function must appear as standalone statements that are paired with an earlier call of pthread_cleanup_push(3) in the same lexical scope. RETURN VALUES
The pthread_cleanup_pop() function does not return any value. ERRORS
None SEE ALSO
pthread_cleanup_push(3), pthread_exit(3) STANDARDS
The pthread_cleanup_pop() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). BSD
October 25, 2014 BSD

Check Out this Related Man Page

PTHREAD_CLEANUP_PUSH(3) 				   BSD Library Functions Manual 				   PTHREAD_CLEANUP_PUSH(3)

NAME
pthread_cleanup_push -- add a cleanup function for thread exit LIBRARY
POSIX Threads Library (libpthread, -lpthread) SYNOPSIS
#include <pthread.h> void pthread_cleanup_push(void (*cleanup_routine)(void *), void *arg); 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. When cleanup_routine is called, it is passed arg as its only argument. The pthread_cleanup_push() function is implemented as a macro that opens a new block. Invocations of this function must appear as standalone statements that are paired with a later call of pthread_cleanup_pop(3) in the same lexical scope. RETURN VALUES
The pthread_cleanup_push() function does not return any value. ERRORS
None SEE ALSO
pthread_cleanup_pop(3), pthread_exit(3) STANDARDS
The pthread_cleanup_push() function conforms to ISO/IEC 9945-1:1996 (``POSIX.1''). BSD
October 25, 2014 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