GLIBC_PRIVATE {
__libc_alloca_cutoff;
__libc_pthread_init;
+ __pthread_cleanup_stack;
}
}
#include <pthread-functions.h>
#include <libc-lock.h>
#include <fork.h>
+#include <pt-internal.h>
/* Pointers to the libc functions. */
struct pthread_functions __libc_pthread_functions attribute_hidden;
FORWARD (pthread_setcanceltype, (int type, int *oldtype), (type, oldtype), 0)
-struct __pthread_cancelation_handler *dummy_list;
FORWARD2 (__pthread_get_cleanup_stack, struct __pthread_cancelation_handler **,
- (void), (), return &dummy_list);
+ (void), (), return &__pthread_cleanup_stack);
#include <string.h>
#include <pthread-functions.h>
+__thread struct __pthread_cancelation_handler *__pthread_cleanup_stack;
+
void
__libc_pthread_init (const struct pthread_functions *functions)
{
new->state_lock = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
new->state_cond = (pthread_cond_t) PTHREAD_COND_INITIALIZER;
- new->cancelation_handlers = 0;
-
memset (&new->res_state, '\0', sizeof (new->res_state));
new->tcb = NULL;
struct __pthread_cancelation_handler **
__pthread_get_cleanup_stack (void)
{
- return &_pthread_self ()->cancelation_handlers;
+ return &__pthread_cleanup_stack;
}
hidden_def(__pthread_get_cleanup_stack)
int cancel_state;
int cancel_type;
int cancel_pending;
- struct __pthread_cancelation_handler *cancelation_handlers;
/* Thread stack. */
void *stackaddr;
#ifndef _pthread_self
extern struct __pthread *_pthread_self (void);
#endif
+
+/* Stores the stack of cleanup handlers for the thread. */
+extern __thread struct __pthread_cancelation_handler *__pthread_cleanup_stack;
\f
/* Initialize the pthreads library. */