Back to index

glibc  2.9
Functions
unwind.c File Reference
#include <setjmp.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "pthreadP.h"
#include <jmpbuf-unwind.h>

Go to the source code of this file.

Functions

void __cleanup_fct_attribute __attribute ((noreturn))
 hidden_def (__pthread_unwind)

Function Documentation

void __cleanup_fct_attribute __attribute ( (noreturn)  )

Definition at line 118 of file unwind.c.

{
  struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;
  struct pthread *self = THREAD_SELF;

#ifdef HAVE_FORCED_UNWIND
  /* This is not a catchable exception, so don't provide any details about
     the exception type.  We do need to initialize the field though.  */
  THREAD_SETMEM (self, exc.exception_class, 0);
  THREAD_SETMEM (self, exc.exception_cleanup, unwind_cleanup);

  _Unwind_ForcedUnwind (&self->exc, unwind_stop, ibuf);
#else
  /* Handle the compatibility stuff first.  Execute all handlers
     registered with the old method.  We don't execute them in order,
     instead, they will run first.  */
  struct _pthread_cleanup_buffer *oldp = ibuf->priv.data.cleanup;
  struct _pthread_cleanup_buffer *curp = THREAD_GETMEM (self, cleanup);

  if (curp != oldp)
    {
      do
       {
         /* Pointer to the next element.  */
         struct _pthread_cleanup_buffer *nextp = curp->__prev;

         /* Call the handler.  */
         curp->__routine (curp->__arg);

         /* To the next.  */
         curp = nextp;
       }
      while (curp != oldp);

      /* Mark the current element as handled.  */
      THREAD_SETMEM (self, cleanup, curp);
    }

  /* We simply jump to the registered setjmp buffer.  */
  __libc_unwind_longjmp ((struct __jmp_buf_tag *) ibuf->cancel_jmp_buf, 1);
#endif
  /* NOTREACHED */

  /* We better do not get here.  */
  abort ();
}

Here is the call graph for this function:

Definition at line 165 of file unwind.c.

{
  struct pthread_unwind_buf *ibuf = (struct pthread_unwind_buf *) buf;

  __pthread_unwind ((__pthread_unwind_buf_t *) ibuf->priv.data.prev);
}

Here is the call graph for this function: