Index: libpthread/linuxthreads.old/ptfork.c =================================================================== --- libpthread/linuxthreads.old/ptfork.c (revision 24146) +++ libpthread/linuxthreads.old/ptfork.c (working copy) @@ -32,7 +32,7 @@ struct handler_list { struct handler_list * next; }; -static pthread_mutex_t pthread_atfork_lock = PTHREAD_MUTEX_INITIALIZER; +__UCLIBC_MUTEX_STATIC(pthread_atfork_lock, PTHREAD_MUTEX_INITIALIZER); static struct handler_list * pthread_atfork_prepare = NULL; static struct handler_list * pthread_atfork_parent = NULL; static struct handler_list * pthread_atfork_child = NULL; @@ -71,15 +71,16 @@ int pthread_atfork(void (*prepare)(void) { struct handler_list_block * block = (struct handler_list_block *) malloc(sizeof(struct handler_list_block)); - if (block == NULL) return ENOMEM; - __pthread_mutex_lock(&pthread_atfork_lock); + if (block == NULL) + return ENOMEM; + __UCLIBC_MUTEX_LOCK(pthread_atfork_lock); /* "prepare" handlers are called in LIFO */ pthread_insert_list(&pthread_atfork_prepare, prepare, &block->prepare, 0); /* "parent" handlers are called in FIFO */ pthread_insert_list(&pthread_atfork_parent, parent, &block->parent, 1); /* "child" handlers are called in FIFO */ pthread_insert_list(&pthread_atfork_child, child, &block->child, 1); - __pthread_mutex_unlock(&pthread_atfork_lock); + __UCLIBC_MUTEX_UNLOCK(pthread_atfork_lock); return 0; } //strong_alias (__pthread_atfork, pthread_atfork) @@ -101,7 +102,7 @@ pid_t __fork(void) pid_t pid; struct handler_list * prepare, * child, * parent; - __pthread_mutex_lock(&pthread_atfork_lock); + __UCLIBC_MUTEX_LOCK(pthread_atfork_lock); prepare = pthread_atfork_prepare; child = pthread_atfork_child; parent = pthread_atfork_parent; @@ -109,13 +110,13 @@ pid_t __fork(void) __pthread_once_fork_prepare(); #ifdef __MALLOC__ - __pthread_mutex_lock(&__malloc_sbrk_lock); - __pthread_mutex_lock(&__malloc_heap_lock); + __UCLIBC_MUTEX_LOCK(__malloc_sbrk_lock); + __UCLIBC_MUTEX_LOCK(__malloc_heap_lock); #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ - __pthread_mutex_lock(&__malloc_mmb_heap_lock); + __UCLIBC_MUTEX_LOCK(__malloc_mmb_heap_lock); #endif #elif defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) - __pthread_mutex_lock(&__malloc_lock); + __UCLIBC_MUTEX_LOCK(__malloc_lock); #endif pid = __libc_fork(); @@ -136,15 +137,15 @@ pid_t __fork(void) pthread_call_handlers(child); } else { #if defined(__MALLOC_STANDARD__) || defined(__MALLOC_SIMPLE__) - __pthread_mutex_unlock(&__malloc_lock); + __UCLIBC_MUTEX_UNLOCK(__malloc_lock); #elif defined(__MALLOC__) #ifdef __UCLIBC_UCLINUX_BROKEN_MUNMAP__ - __pthread_mutex_unlock(&__malloc_mmb_heap_lock); + __UCLIBC_MUTEX_UNLOCK(__malloc_mmb_heap_lock); #endif - __pthread_mutex_unlock(&__malloc_heap_lock); - __pthread_mutex_unlock(&__malloc_sbrk_lock); + __UCLIBC_MUTEX_UNLOCK(__malloc_heap_lock); + __UCLIBC_MUTEX_UNLOCK(__malloc_sbrk_lock); #endif - __pthread_mutex_unlock(&pthread_atfork_lock); + __UCLIBC_MUTEX_UNLOCK(pthread_atfork_lock); __pthread_once_fork_parent(); pthread_call_handlers(parent); }