summaryrefslogtreecommitdiff
path: root/locks
diff options
context:
space:
mode:
authorYann Ylavic <ylavic@apache.org>2015-03-25 09:07:34 +0000
committerYann Ylavic <ylavic@apache.org>2015-03-25 09:07:34 +0000
commit7f19cf3857f8fbca1098f839f21bfd2cf06a4999 (patch)
tree2f994841ca66e644ac638154fb871eb0f0446c04 /locks
parent60d4ecf83cf740cba89650775c371a8a731fa8c5 (diff)
downloadapr-7f19cf3857f8fbca1098f839f21bfd2cf06a4999.tar.gz
locks: follow up to r1667900.
In apr_global_mutex_timedlock(), we can avoid converting from relative to absolute time if thread locking is not needed. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1669077 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'locks')
-rw-r--r--locks/unix/global_mutex.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/locks/unix/global_mutex.c b/locks/unix/global_mutex.c
index 4525eaeee..19485c487 100644
--- a/locks/unix/global_mutex.c
+++ b/locks/unix/global_mutex.c
@@ -147,20 +147,22 @@ APR_DECLARE(apr_status_t) apr_global_mutex_timedlock(apr_global_mutex_t *mutex,
{
apr_status_t rv;
- if (timeout >= 0 && !absolute) {
- timeout += apr_time_now();
- }
-
#if APR_HAS_THREADS
if (mutex->thread_mutex) {
- rv = apr_thread_mutex_timedlock(mutex->thread_mutex, timeout, 1);
+ if (timeout >= 0 && !absolute) {
+ timeout += apr_time_now();
+ absolute = 1;
+ }
+ rv = apr_thread_mutex_timedlock(mutex->thread_mutex, timeout,
+ absolute);
if (rv != APR_SUCCESS) {
return rv;
}
}
#endif /* APR_HAS_THREADS */
- rv = apr_proc_mutex_timedlock(mutex->proc_mutex, timeout, 1);
+ rv = apr_proc_mutex_timedlock(mutex->proc_mutex, timeout,
+ absolute);
#if APR_HAS_THREADS
if (rv != APR_SUCCESS) {