[uClibc-cvs] uClibc/libc/stdlib/malloc heap.h, 1.15, 1.16 malloc.h, 1.17, 1.18

Manuel Novoa III mjn3 at uclibc.org
Sat Dec 27 23:30:48 UTC 2003


Update of /var/cvs/uClibc/libc/stdlib/malloc
In directory nail:/tmp/cvs-serv11655/libc/stdlib/malloc

Modified Files:
	heap.h malloc.h 
Log Message:
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.



Index: heap.h
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc/heap.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- heap.h	22 Sep 2003 04:01:11 -0000	1.15
+++ heap.h	27 Dec 2003 23:30:45 -0000	1.16
@@ -136,8 +136,8 @@
 
 
 #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

Index: malloc.h
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/malloc/malloc.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- malloc.h	6 Sep 2003 13:34:48 -0000	1.17
+++ malloc.h	27 Dec 2003 23:30:45 -0000	1.18
@@ -136,8 +136,8 @@
    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__ */




More information about the uClibc-cvs mailing list