summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_mutex.c
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-04-04 02:57:49 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-04-04 02:57:49 +0000
commit31f2b819c68f20ff188724669d3044a0680e3ceb (patch)
tree3cbec5633c5b1de6974d08e11807ee0ce2110a82 /lib/libthr/thread/thr_mutex.c
parent2cacffb02b10bf82a1a5ee4d88c3092821839d16 (diff)
downloadFreeBSD-src-31f2b819c68f20ff188724669d3044a0680e3ceb.zip
FreeBSD-src-31f2b819c68f20ff188724669d3044a0680e3ceb.tar.gz
WARNS level 4 cleanup.
Diffstat (limited to 'lib/libthr/thread/thr_mutex.c')
-rw-r--r--lib/libthr/thread/thr_mutex.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c
index 67b4760..fdceadf 100644
--- a/lib/libthr/thread/thr_mutex.c
+++ b/lib/libthr/thread/thr_mutex.c
@@ -33,12 +33,15 @@
* $FreeBSD$
*/
+#include "namespace.h"
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/param.h>
#include <sys/queue.h>
#include <pthread.h>
+#include "un-namespace.h"
+
#include "thr_private.h"
#if defined(_PTHREADS_INVARIANTS)
@@ -64,8 +67,15 @@
/*
* Prototypes
*/
-static int mutex_self_trylock(struct pthread *, pthread_mutex_t);
-static int mutex_self_lock(struct pthread *, pthread_mutex_t,
+int __pthread_mutex_init(pthread_mutex_t *mutex,
+ const pthread_mutexattr_t *mutex_attr);
+int __pthread_mutex_trylock(pthread_mutex_t *mutex);
+int __pthread_mutex_lock(pthread_mutex_t *mutex);
+int __pthread_mutex_timedlock(pthread_mutex_t *mutex,
+ const struct timespec *abstime);
+
+static int mutex_self_trylock(pthread_mutex_t);
+static int mutex_self_lock(pthread_mutex_t,
const struct timespec *abstime);
static int mutex_unlock_common(pthread_mutex_t *, int);
@@ -265,7 +275,7 @@ mutex_trylock_common(struct pthread *curthread, pthread_mutex_t *mutex)
MUTEX_ASSERT_NOT_OWNED(m);
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
} else if (m->m_owner == curthread) {
- ret = mutex_self_trylock(curthread, m);
+ ret = mutex_self_trylock(m);
} /* else {} */
return (ret);
@@ -321,7 +331,7 @@ mutex_lock_common(struct pthread *curthread, pthread_mutex_t *mutex,
MUTEX_ASSERT_NOT_OWNED(m);
TAILQ_INSERT_TAIL(&curthread->mutexq, m, m_qe);
} else if (m->m_owner == curthread) {
- ret = mutex_self_lock(curthread, m, abstime);
+ ret = mutex_self_lock(m, abstime);
} else {
if (abstime == NULL) {
THR_UMTX_LOCK(curthread, &m->m_lock);
@@ -461,7 +471,7 @@ _mutex_cv_lock(pthread_mutex_t *m)
}
static int
-mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
+mutex_self_trylock(pthread_mutex_t m)
{
int ret;
@@ -489,8 +499,7 @@ mutex_self_trylock(struct pthread *curthread, pthread_mutex_t m)
}
static int
-mutex_self_lock(struct pthread *curthread, pthread_mutex_t m,
- const struct timespec *abstime)
+mutex_self_lock(pthread_mutex_t m, const struct timespec *abstime)
{
struct timespec ts1, ts2;
int ret;
@@ -607,8 +616,10 @@ _pthread_mutex_getprioceiling(pthread_mutex_t *mutex,
ret = EINVAL;
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
ret = EINVAL;
- else
- ret = (*mutex)->m_prio;
+ else {
+ *prioceiling = (*mutex)->m_prio;
+ ret = 0;
+ }
return(ret);
}
@@ -624,10 +635,10 @@ _pthread_mutex_setprioceiling(pthread_mutex_t *mutex,
ret = EINVAL;
else if ((*mutex)->m_protocol != PTHREAD_PRIO_PROTECT)
ret = EINVAL;
- else if ((ret = pthread_mutex_lock(mutex)) == 0) {
+ else if ((ret = _pthread_mutex_lock(mutex)) == 0) {
tmp = (*mutex)->m_prio;
(*mutex)->m_prio = prioceiling;
- ret = pthread_mutex_unlock(mutex);
+ ret = _pthread_mutex_unlock(mutex);
/* Return the old ceiling. */
*old_ceiling = tmp;
OpenPOWER on IntegriCloud