From d05dafe2fc23137f8decd641d82d23f45e16281c Mon Sep 17 00:00:00 2001 From: Manuel Novoa III Date: Sat, 27 Dec 2003 23:30:50 +0000 Subject: Fix a long-standing bug with pthreads. A couple of linuxthreads files were including libc-lock.h which had a bunch of weak pragmas. Also, uClibc supplied a number of no-op weak thread functions even though many weren't needed. This combined result was that sometimes the functional versions of thread functions in pthread would not override the weaks in libc. While fixing this, I also prepended double-underscore to all necessary weak thread funcs in uClibc, and removed all unused weaks. I did a test build, but haven't tested this since these changes are a backport from my working tree. I did test the changes there and no longer need to explicitly add -lpthread in the perl build for perl to pass its thread self tests. --- libc/stdlib/malloc/heap.h | 4 ++-- libc/stdlib/malloc/malloc.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'libc/stdlib/malloc') diff --git a/libc/stdlib/malloc/heap.h b/libc/stdlib/malloc/heap.h index 3dab65396..0210d9098 100644 --- a/libc/stdlib/malloc/heap.h +++ b/libc/stdlib/malloc/heap.h @@ -136,8 +136,8 @@ extern void __heap_check (struct heap *heap, const char *str); #ifdef HEAP_USE_LOCKING -# define __heap_lock(heap) pthread_mutex_lock (&(heap)->lock) -# define __heap_unlock(heap) pthread_mutex_unlock (&(heap)->lock) +# define __heap_lock(heap) __pthread_mutex_lock (&(heap)->lock) +# define __heap_unlock(heap) __pthread_mutex_unlock (&(heap)->lock) #else /* !__UCLIBC_HAS_THREADS__ */ /* Without threads, mutex operations are a nop. */ # define __heap_lock(heap) (void)0 diff --git a/libc/stdlib/malloc/malloc.h b/libc/stdlib/malloc/malloc.h index c66778eeb..e5010d49b 100644 --- a/libc/stdlib/malloc/malloc.h +++ b/libc/stdlib/malloc/malloc.h @@ -136,8 +136,8 @@ typedef pthread_mutex_t malloc_mutex_t; things will break if these multiple calls are interleaved with another thread's use of sbrk!). */ extern malloc_mutex_t __malloc_sbrk_lock; -# define __malloc_lock_sbrk() pthread_mutex_lock (&__malloc_sbrk_lock) -# define __malloc_unlock_sbrk() pthread_mutex_unlock (&__malloc_sbrk_lock) +# define __malloc_lock_sbrk() __pthread_mutex_lock (&__malloc_sbrk_lock) +# define __malloc_unlock_sbrk() __pthread_mutex_unlock (&__malloc_sbrk_lock) # endif /* MALLOC_USE_SBRK */ #else /* !__UCLIBC_HAS_THREADS__ */ -- cgit v1.2.3