From 8532ba12c656528617fe86945c64626b1a815280 Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Wed, 25 Jan 2006 14:59:17 +0000 Subject: make use of the internals provided earlier --- libpthread/linuxthreads.old/condvar.c | 14 +++++++------- libpthread/linuxthreads.old/lockfile.c | 4 ++++ libpthread/linuxthreads.old/ptfork.c | 8 ++++---- libpthread/linuxthreads.old/pthread.c | 13 +++++++------ libpthread/linuxthreads.old/specific.c | 12 ++++++------ 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/libpthread/linuxthreads.old/condvar.c b/libpthread/linuxthreads.old/condvar.c index c5a4f81da..62df907c1 100644 --- a/libpthread/linuxthreads.old/condvar.c +++ b/libpthread/linuxthreads.old/condvar.c @@ -96,7 +96,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) pthread_exit(PTHREAD_CANCELED); } - pthread_mutex_unlock(mutex); + __pthread_mutex_unlock(mutex); spurious_wakeup_count = 0; while (1) @@ -121,7 +121,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) if (THREAD_GETMEM(self, p_woken_by_cancel) && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { THREAD_SETMEM(self, p_woken_by_cancel, 0); - pthread_mutex_lock(mutex); + __pthread_mutex_lock(mutex); pthread_exit(PTHREAD_CANCELED); } @@ -129,7 +129,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) while (spurious_wakeup_count--) restart(self); - pthread_mutex_lock(mutex); + __pthread_mutex_lock(mutex); return 0; } @@ -171,7 +171,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond, pthread_exit(PTHREAD_CANCELED); } - pthread_mutex_unlock(mutex); + __pthread_mutex_unlock(mutex); spurious_wakeup_count = 0; while (1) @@ -188,7 +188,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond, if (was_on_queue) { __pthread_set_own_extricate_if(self, 0); - pthread_mutex_lock(mutex); + __pthread_mutex_lock(mutex); return ETIMEDOUT; } @@ -215,7 +215,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond, if (THREAD_GETMEM(self, p_woken_by_cancel) && THREAD_GETMEM(self, p_cancelstate) == PTHREAD_CANCEL_ENABLE) { THREAD_SETMEM(self, p_woken_by_cancel, 0); - pthread_mutex_lock(mutex); + __pthread_mutex_lock(mutex); pthread_exit(PTHREAD_CANCELED); } @@ -223,7 +223,7 @@ pthread_cond_timedwait_relative(pthread_cond_t *cond, while (spurious_wakeup_count--) restart(self); - pthread_mutex_lock(mutex); + __pthread_mutex_lock(mutex); return 0; } diff --git a/libpthread/linuxthreads.old/lockfile.c b/libpthread/linuxthreads.old/lockfile.c index 7bd2155ac..48131bb4a 100644 --- a/libpthread/linuxthreads.old/lockfile.c +++ b/libpthread/linuxthreads.old/lockfile.c @@ -20,6 +20,10 @@ #include #include +libpthread_hidden_proto(pthread_mutexattr_init) +libpthread_hidden_proto(pthread_mutexattr_settype) +libpthread_hidden_proto(pthread_mutexattr_destroy) + /* Note: glibc puts flockfile, funlockfile, and ftrylockfile in both * libc and libpthread. In uClibc, they are now in libc only. */ diff --git a/libpthread/linuxthreads.old/ptfork.c b/libpthread/linuxthreads.old/ptfork.c index b153621b2..38fb60e9d 100644 --- a/libpthread/linuxthreads.old/ptfork.c +++ b/libpthread/linuxthreads.old/ptfork.c @@ -61,14 +61,14 @@ 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); + __pthread_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); + __pthread_mutex_unlock(&pthread_atfork_lock); return 0; } //strong_alias (__pthread_atfork, pthread_atfork) @@ -85,11 +85,11 @@ pid_t attribute_hidden __fork(void) pid_t pid; struct handler_list * prepare, * child, * parent; - pthread_mutex_lock(&pthread_atfork_lock); + __pthread_mutex_lock(&pthread_atfork_lock); prepare = pthread_atfork_prepare; child = pthread_atfork_child; parent = pthread_atfork_parent; - pthread_mutex_unlock(&pthread_atfork_lock); + __pthread_mutex_unlock(&pthread_atfork_lock); pthread_call_handlers(prepare); pid = __libc_fork(); if (pid == 0) { diff --git a/libpthread/linuxthreads.old/pthread.c b/libpthread/linuxthreads.old/pthread.c index ddf98a1db..1cd25ed4e 100644 --- a/libpthread/linuxthreads.old/pthread.c +++ b/libpthread/linuxthreads.old/pthread.c @@ -40,7 +40,8 @@ /* mods for uClibc: __libc_sigaction is not in any standard headers */ extern __typeof(sigaction) __libc_sigaction; - +libpthread_hidden_proto(waitpid) +libpthread_hidden_proto(raise) /* These variables are used by the setup code. */ extern int _errno; @@ -316,11 +317,11 @@ struct pthread_functions __pthread_functions = .ptr___pthread_exit = pthread_exit, .ptr_pthread_getschedparam = pthread_getschedparam, .ptr_pthread_setschedparam = pthread_setschedparam, - .ptr_pthread_mutex_destroy = pthread_mutex_destroy, - .ptr_pthread_mutex_init = pthread_mutex_init, - .ptr_pthread_mutex_lock = pthread_mutex_lock, - .ptr_pthread_mutex_trylock = pthread_mutex_trylock, - .ptr_pthread_mutex_unlock = pthread_mutex_unlock, + .ptr_pthread_mutex_destroy = __pthread_mutex_destroy, + .ptr_pthread_mutex_init = __pthread_mutex_init, + .ptr_pthread_mutex_lock = __pthread_mutex_lock, + .ptr_pthread_mutex_trylock = __pthread_mutex_trylock, + .ptr_pthread_mutex_unlock = __pthread_mutex_unlock, .ptr_pthread_self = pthread_self, .ptr_pthread_setcancelstate = pthread_setcancelstate, .ptr_pthread_setcanceltype = pthread_setcanceltype, diff --git a/libpthread/linuxthreads.old/specific.c b/libpthread/linuxthreads.old/specific.c index b6ca94389..72409b30b 100644 --- a/libpthread/linuxthreads.old/specific.c +++ b/libpthread/linuxthreads.old/specific.c @@ -42,18 +42,18 @@ int pthread_key_create(pthread_key_t * key, destr_function destr) { int i; - pthread_mutex_lock(&pthread_keys_mutex); + __pthread_mutex_lock(&pthread_keys_mutex); for (i = 0; i < PTHREAD_KEYS_MAX; i++) { if (! pthread_keys[i].in_use) { /* Mark key in use */ pthread_keys[i].in_use = 1; pthread_keys[i].destr = destr; - pthread_mutex_unlock(&pthread_keys_mutex); + __pthread_mutex_unlock(&pthread_keys_mutex); *key = i; return 0; } } - pthread_mutex_unlock(&pthread_keys_mutex); + __pthread_mutex_unlock(&pthread_keys_mutex); return EAGAIN; } @@ -62,9 +62,9 @@ int pthread_key_delete(pthread_key_t key) { pthread_descr self = thread_self(); - pthread_mutex_lock(&pthread_keys_mutex); + __pthread_mutex_lock(&pthread_keys_mutex); if (key >= PTHREAD_KEYS_MAX || !pthread_keys[key].in_use) { - pthread_mutex_unlock(&pthread_keys_mutex); + __pthread_mutex_unlock(&pthread_keys_mutex); return EINVAL; } pthread_keys[key].in_use = 0; @@ -90,7 +90,7 @@ int pthread_key_delete(pthread_key_t key) } while (th != self); } - pthread_mutex_unlock(&pthread_keys_mutex); + __pthread_mutex_unlock(&pthread_keys_mutex); return 0; } -- cgit v1.2.3