summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorbrianp <brianp@13f79535-47bb-0310-9956-ffa450edef68>2002-04-28 03:21:24 +0000
committerbrianp <brianp@13f79535-47bb-0310-9956-ffa450edef68>2002-04-28 03:21:24 +0000
commit93219177b76e345c8e31069c199503e81e847c5e (patch)
treea67757c3bf4ef768a40a6ba24a33be1541301a62 /locks
parenteb2b70951a286ec9cce1d5cbd6851370685807d7 (diff)
downloadlibapr-93219177b76e345c8e31069c199503e81e847c5e.tar.gz
Optimization: rearranged the mutex lock/unlock code to
eliminate a conditional branch on platforms where PTHREAD_SETS_ERRNO is not defined (at present, this means everything except OS/390) git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@63307 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/unix/thread_mutex.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/locks/unix/thread_mutex.c b/locks/unix/thread_mutex.c
index 78a7d8181..170e0b70a 100644
--- a/locks/unix/thread_mutex.c
+++ b/locks/unix/thread_mutex.c
@@ -143,19 +143,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex)
mutex->owner = apr_os_thread_current();
mutex->owner_ref = 1;
+ return rv;
}
else {
rv = pthread_mutex_lock(&mutex->mutex);
- if (rv) {
#ifdef PTHREAD_SETS_ERRNO
+ if (rv) {
rv = errno;
-#endif
- return rv;
}
-
+#endif
+ return rv;
}
-
- return rv;
}
APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex)
@@ -212,17 +210,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex)
memset(&mutex->owner, 0, sizeof mutex->owner);
mutex->owner_ref = 0;
+ return status;
}
else {
status = pthread_mutex_unlock(&mutex->mutex);
- if (status) {
#ifdef PTHREAD_SETS_ERRNO
+ if (status) {
status = errno;
-#endif
- return status;
}
+#endif
+ return status;
}
- return status;
}
APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex)