diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-24 02:55:31 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2016-09-26 20:23:24 +0200 |
commit | 29ff9055c80efe77a7130767a9fcb3ab8c67e8ce (patch) | |
tree | b061656c1336d7d73ed5eef59352e3d50d8147a7 /libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h | |
parent | b06f85d62c41a4ed108628b1c564203f36c0ab4e (diff) |
use a single libc and deduplicate threading code
Similar to musl libc a single libc has many benefits and solves
some open issues with uClibc-ng.
- no pthread_mutex_* weak symbols exported anymore
- applications no longer failing to link when either
-lrt or -lpthread are missing for dynamic and static linking mode
- smaller C library
- slightly better runtime performance
Diffstat (limited to 'libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h')
-rw-r--r-- | libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h | 66 |
1 files changed, 2 insertions, 64 deletions
diff --git a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h index a7c0249cf..c00d60bf0 100644 --- a/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h +++ b/libpthread/linuxthreads/sysdeps/pthread/bits/libc-lock.h @@ -105,13 +105,8 @@ typedef pthread_key_t __libc_key_t; (FUNC != NULL ? FUNC ARGS : ELSE) # endif #endif -#if defined _LIBC && !defined NOT_IN_libc && defined SHARED -# define __libc_maybe_call2(FUNC, ARGS, ELSE) \ - ({__builtin_expect (__libc_pthread_functions.ptr_##FUNC != NULL, 0) \ - ? __libc_pthread_functions.ptr_##FUNC ARGS : ELSE; }) -#else -# define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) -#endif + +#define __libc_maybe_call2(FUNC, ARGS, ELSE) __libc_maybe_call (__##FUNC, ARGS, ELSE) /* Initialize the named lock variable, leaving it in a consistent, unlocked state. */ @@ -351,63 +346,6 @@ extern int __pthread_atfork (void (*__prepare) (void), void (*__child) (void)); - -/* Make the pthread functions weak so that we can elide them from - single-threaded processes. */ -#ifndef __NO_WEAK_PTHREAD_ALIASES -# ifdef weak_extern -# define BP_SYM(sym) sym -weak_extern (BP_SYM (__pthread_mutex_init)) -weak_extern (BP_SYM (__pthread_mutex_destroy)) -weak_extern (BP_SYM (__pthread_mutex_lock)) -weak_extern (BP_SYM (__pthread_mutex_trylock)) -weak_extern (BP_SYM (__pthread_mutex_unlock)) -weak_extern (BP_SYM (__pthread_mutexattr_init)) -weak_extern (BP_SYM (__pthread_mutexattr_destroy)) -weak_extern (BP_SYM (__pthread_mutexattr_settype)) -weak_extern (BP_SYM (__pthread_rwlock_init)) -weak_extern (BP_SYM (__pthread_rwlock_destroy)) -weak_extern (BP_SYM (__pthread_rwlock_rdlock)) -weak_extern (BP_SYM (__pthread_rwlock_tryrdlock)) -weak_extern (BP_SYM (__pthread_rwlock_wrlock)) -weak_extern (BP_SYM (__pthread_rwlock_trywrlock)) -weak_extern (BP_SYM (__pthread_rwlock_unlock)) -weak_extern (BP_SYM (__pthread_key_create)) -weak_extern (BP_SYM (__pthread_setspecific)) -weak_extern (BP_SYM (__pthread_getspecific)) -weak_extern (BP_SYM (__pthread_once)) -weak_extern (__pthread_atfork) -weak_extern (BP_SYM (_pthread_cleanup_push)) -weak_extern (BP_SYM (_pthread_cleanup_pop)) -weak_extern (BP_SYM (_pthread_cleanup_push_defer)) -weak_extern (BP_SYM (_pthread_cleanup_pop_restore)) -# else -# pragma weak __pthread_mutex_init -# pragma weak __pthread_mutex_destroy -# pragma weak __pthread_mutex_lock -# pragma weak __pthread_mutex_trylock -# pragma weak __pthread_mutex_unlock -# pragma weak __pthread_mutexattr_init -# pragma weak __pthread_mutexattr_destroy -# pragma weak __pthread_mutexattr_settype -# pragma weak __pthread_rwlock_destroy -# pragma weak __pthread_rwlock_rdlock -# pragma weak __pthread_rwlock_tryrdlock -# pragma weak __pthread_rwlock_wrlock -# pragma weak __pthread_rwlock_trywrlock -# pragma weak __pthread_rwlock_unlock -# pragma weak __pthread_key_create -# pragma weak __pthread_setspecific -# pragma weak __pthread_getspecific -# pragma weak __pthread_once -# pragma weak __pthread_atfork -# pragma weak _pthread_cleanup_push_defer -# pragma weak _pthread_cleanup_pop_restore -# pragma weak _pthread_cleanup_push -# pragma weak _pthread_cleanup_pop -# endif -#endif - /* We need portable names for some functions. E.g., when they are used as argument to __libc_cleanup_region_start. */ #define __libc_mutex_unlock __pthread_mutex_unlock |