summaryrefslogtreecommitdiffstats
path: root/lib/libthr
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2006-04-23 11:23:37 +0000
committerdavidxu <davidxu@FreeBSD.org>2006-04-23 11:23:37 +0000
commit8001df6f90daf0e9c80f391859438fdd1835fd5c (patch)
treecbe40e36ef40b6163d0430b93340e73d13b94066 /lib/libthr
parent10a18d66fbe1c08a3166cbdd5316dbf3b28ef27d (diff)
downloadFreeBSD-src-8001df6f90daf0e9c80f391859438fdd1835fd5c.zip
FreeBSD-src-8001df6f90daf0e9c80f391859438fdd1835fd5c.tar.gz
Remove multiple _get_curthread() calls.
Diffstat (limited to 'lib/libthr')
-rw-r--r--lib/libthr/thread/thr_rwlock.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/lib/libthr/thread/thr_rwlock.c b/lib/libthr/thread/thr_rwlock.c
index ea2c763..81d1459 100644
--- a/lib/libthr/thread/thr_rwlock.c
+++ b/lib/libthr/thread/thr_rwlock.c
@@ -172,7 +172,6 @@ rwlock_rdlock_common (pthread_rwlock_t *rwlock, const struct timespec *abstime)
return (EAGAIN);
}
- curthread = _get_curthread();
if ((curthread->rdlock_count > 0) && (prwlock->state > 0)) {
/*
* To avoid having to track all the rdlocks held by
@@ -256,7 +255,6 @@ _pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock)
if ((ret = _pthread_mutex_lock(&prwlock->lock)) != 0)
return (ret);
- curthread = _get_curthread();
if (prwlock->state == MAX_READ_LOCKS)
ret = EAGAIN;
else if ((curthread->rdlock_count > 0) && (prwlock->state > 0)) {
@@ -317,7 +315,7 @@ _pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock)
int
_pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
{
- struct pthread *curthread;
+ struct pthread *curthread = _get_curthread();
pthread_rwlock_t prwlock;
int ret;
@@ -333,7 +331,6 @@ _pthread_rwlock_unlock (pthread_rwlock_t *rwlock)
if ((ret = _pthread_mutex_lock(&prwlock->lock)) != 0)
return (ret);
- curthread = _get_curthread();
if (prwlock->state > 0) {
curthread->rdlock_count--;
prwlock->state--;
OpenPOWER on IntegriCloud