diff options
author | Mike Frysinger <vapier@gentoo.org> | 2006-01-04 03:45:56 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2006-01-04 03:45:56 +0000 |
commit | e9264e49f3777c298e8a734cf4483c26b2602584 (patch) | |
tree | bc99d793d97a1d73bc55a256f6983c5d26fcc925 /libpthread/linuxthreads.old/sysdeps/pthread/bits | |
parent | cd662e64be1b10615e2fb44d5f3dc97eca905a31 (diff) |
update pthread weak handling to the style glibc uses
Diffstat (limited to 'libpthread/linuxthreads.old/sysdeps/pthread/bits')
-rw-r--r-- | libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h index 58b986a49..fc8388ab8 100644 --- a/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h +++ b/libpthread/linuxthreads.old/sysdeps/pthread/bits/libc-tsd.h @@ -35,6 +35,8 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, #include <sys/cdefs.h> #include <tls.h> +#include <linuxthreads.old/internals.h> + #if USE_TLS && HAVE___THREAD /* When __thread works, the generic definition is what we want. */ @@ -42,25 +44,31 @@ enum __libc_tsd_key_t { _LIBC_TSD_KEY_MALLOC = 0, #else -extern void *(*__libc_internal_tsd_get) (enum __libc_tsd_key_t); -extern int (*__libc_internal_tsd_set) (enum __libc_tsd_key_t, __const void *); -extern void **(*const __libc_internal_tsd_address) (enum __libc_tsd_key_t) - __attribute__ ((__const__)); +# ifndef SHARED +extern void ** __pthread_internal_tsd_address (int); +extern void *__pthread_internal_tsd_get (int); +extern int __pthread_internal_tsd_set (int, const void *); -#define __libc_tsd_address(KEY) \ - (__libc_internal_tsd_address != NULL \ - ? __libc_internal_tsd_address (_LIBC_TSD_KEY_##KEY) \ - : &__libc_tsd_##KEY##_data) +weak_extern (__pthread_internal_tsd_address) +weak_extern (__pthread_internal_tsd_get) +weak_extern (__pthread_internal_tsd_set) +# endif + +#define __libc_maybe_call2(FUNC, ARGS, ELSE) \ + ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \ + ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; }) #define __libc_tsd_define(CLASS, KEY) CLASS void *__libc_tsd_##KEY##_data; +#define __libc_tsd_address(KEY) \ + __libc_maybe_call2 (pthread_internal_tsd_address, \ + (_LIBC_TSD_KEY_##KEY), &__libc_tsd_##KEY##_data) #define __libc_tsd_get(KEY) \ - (__libc_internal_tsd_get != NULL \ - ? __libc_internal_tsd_get (_LIBC_TSD_KEY_##KEY) \ - : __libc_tsd_##KEY##_data) + __libc_maybe_call2 (pthread_internal_tsd_get, \ + (_LIBC_TSD_KEY_##KEY), __libc_tsd_##KEY##_data) #define __libc_tsd_set(KEY, VALUE) \ - (__libc_internal_tsd_set != NULL \ - ? __libc_internal_tsd_set (_LIBC_TSD_KEY_##KEY, (VALUE)) \ - : ((__libc_tsd_##KEY##_data = (VALUE)), 0)) + __libc_maybe_call2 (pthread_internal_tsd_set, \ + (_LIBC_TSD_KEY_##KEY, (VALUE)), \ + (__libc_tsd_##KEY##_data = (VALUE), 0)) #endif |