diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2007-06-13 00:00:00 +0200 |
---|---|---|
committer | Thomas Schwinge <thomas@schwinge.name> | 2011-10-20 16:51:57 +0200 |
commit | 1b37ff3740644d3febf6ae6e7f756a8d152a37e6 (patch) | |
tree | f63be8efc388bb0789334618f02478cce852a7e6 /pthread/pt-internal.h | |
parent | 2e10e74697a257cd032d586c0ec7413874758c82 (diff) |
TLS support for libpthread, Mach/Hurd (x86).
* Makefile (CFLAGS): Define ENABLE_TLS.
* pthread/pt-create.c (__pthread_create_internal) [ENABLE_TLS]: Call
into glibc to allocate static TLS block.
* pthread/pt-exit.c (pthread_exit) [ENABLE_TLS]: Call into glibc to
deallocate static TLS block.
* pthread/pt-internal.h [ENABLE_TLS] (tcbhead_t): New structure; as in
glibc.
(__pthread) [ENABLE_TLS]: Add TCB member.
[ENABLE_TLS] (_dl_allocate_tls, _dl_deallocate_tls): Declare; from
glibc.
* sysdeps/mach/hurd/pt-sysdep.h (__thread_set_pcsp): Rename to
__thread_set_pcsptp. Add SET_TP and TP parameters. Change all
callers.
* sysdeps/mach/hurd/i386/pt-machdep.c (__thread_set_pcsptp): Imlement
TLS support.
* sysdeps/mach/hurd/i386/pt-setup.c (__pthread_setup): Likewise.
Diffstat (limited to 'pthread/pt-internal.h')
-rw-r--r-- | pthread/pt-internal.h | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/pthread/pt-internal.h b/pthread/pt-internal.h index efd4ffb9..159f1cbd 100644 --- a/pthread/pt-internal.h +++ b/pthread/pt-internal.h @@ -1,5 +1,5 @@ /* Internal defenitions for pthreads library. - Copyright (C) 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 2000, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -50,6 +50,16 @@ enum pthread_state # define PTHREAD_SYSDEP_MEMBERS #endif +#ifdef ENABLE_TLS +/* Type of the TCB. */ +typedef struct +{ + void *tcb; /* Points to this structure. */ + void *dtv; /* Vector of pointers to TLS data. */ + thread_t self; /* This thread's control port. */ +} tcbhead_t; +#endif /* ENABLE_TLS */ + /* This structure describes a POSIX thread. */ struct __pthread { @@ -85,6 +95,10 @@ struct __pthread PTHREAD_SYSDEP_MEMBERS +#ifdef ENABLE_TLS + tcbhead_t *tcb; +#endif /* ENABLE_TLS */ + struct __pthread *next, **prevp; }; @@ -272,4 +286,17 @@ const struct __pthread_rwlockattr __pthread_default_rwlockattr; /* Default condition attributes. */ const struct __pthread_condattr __pthread_default_condattr; + +#ifdef ENABLE_TLS + +/* From glibc. */ + +/* Dynamic linker TLS allocation. */ +extern void *_dl_allocate_tls(void *); + +/* Dynamic linker TLS deallocation. */ +extern void _dl_deallocate_tls(void *, int); + +#endif /* ENABLE_TLS */ + #endif /* pt-internal.h */ |