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_pop(3C) 												   pthread_cleanup_pop(3C)

NAME
pthread_cleanup_pop - pop a thread cancellation cleanup handler SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ] #include <pthread.h> void pthread_cleanup_pop(int execute); The pthread_cleanup_pop() function removes the cleanup handler routine at the top of the cancellation cleanup stack of the calling thread and executes it if execute is non-zero. When the thread calls pthread_cleanup_pop() with a non-zero execute argument, the argument at the top of the stack is popped and executed. An argument of 0 pops the handler without executing it. The pthread_cleanup_push(3C) and pthread_cleanup_pop() functions can be implemented as macros. The application must ensure that they appear as statements, and in pairs within the same lexical scope (that is, the pthread_cleanup_push() macro can be thought to expand to a token list whose first token is '{' with pthread_cleanup_pop() expanding to a token list whose last token is the corresponding '}'). The effect of the use of return, break, continue, and goto to prematurely leave a code block described by a pair of pthread_cleanup_push() and pthread_cleanup_pop() function calls is undefined. Using longjmp() or siglongjmp() to jump into or out of a push/pop pair can result in either the matching push or the matching pop statement not getting executed. The pthread_cleanup_pop() function returns no value. No errors are defined. The pthread_cleanup_pop() function will not return an error code of EINTR. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |MT-Safe | +-----------------------------+-----------------------------+ pthread_cancel(3C), pthread_cleanup_push(3C), pthread_exit(3C), pthread_join(3C), pthread_setcancelstate(3C), pthread_setcanceltype(3C), pthread_testcancel(3C), setjmp(3C), attributes(5), cancellation(5), condition(5), standards(5) See cancellation(5) for a discussion of cancellation concepts. 4 Oct 2005 pthread_cleanup_pop(3C)
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