Back to index

glibc  2.9
Functions
ptcleanup.c File Reference
#include <setjmp.h>
#include "pthread.h"
#include "internals.h"
#include <sysdep.h>
#include <jmpbuf-unwind.h>

Go to the source code of this file.

Functions

static uintptr_t demangle_ptr (uintptr_t x)
void __pthread_cleanup_upto (__jmp_buf target, char *targetframe)

Function Documentation

void __pthread_cleanup_upto ( __jmp_buf  target,
char *  targetframe 
)

Definition at line 33 of file ptcleanup.c.

{
  pthread_descr self = thread_self();
  struct _pthread_cleanup_buffer * c;

  for (c = THREAD_GETMEM(self, p_cleanup);
       c != NULL && _JMPBUF_UNWINDS(target, c, demangle_ptr);
       c = c->__prev)
    {
#if _STACK_GROWS_DOWN
      if ((char *) c <= targetframe)
       {
         c = NULL;
         break;
       }
#elif _STACK_GROWS_UP
      if ((char *) c >= targetframe)
       {
         c = NULL;
         break;
       }
#else
# error "Define either _STACK_GROWS_DOWN or _STACK_GROWS_UP"
#endif
      c->__routine(c->__arg);
    }
  THREAD_SETMEM(self, p_cleanup, c);
  if (THREAD_GETMEM(self, p_in_sighandler)
      && _JMPBUF_UNWINDS(target, THREAD_GETMEM(self, p_in_sighandler),
                      demangle_ptr))
    THREAD_SETMEM(self, p_in_sighandler, NULL);
}
static uintptr_t demangle_ptr ( uintptr_t  x) [inline, static]

Definition at line 25 of file ptcleanup.c.

{
#ifdef PTR_DEMANGLE
  PTR_DEMANGLE (x);
#endif
  return x;
}

Here is the caller graph for this function: