You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2015/03/25 10:07:34 UTC
svn commit: r1669077 - /apr/apr/trunk/locks/unix/global_mutex.c
Author: ylavic
Date: Wed Mar 25 09:07:34 2015
New Revision: 1669077
URL: http://svn.apache.org/r1669077
Log:
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.
Modified:
apr/apr/trunk/locks/unix/global_mutex.c
Modified: apr/apr/trunk/locks/unix/global_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/locks/unix/global_mutex.c?rev=1669077&r1=1669076&r2=1669077&view=diff
==============================================================================
--- apr/apr/trunk/locks/unix/global_mutex.c (original)
+++ apr/apr/trunk/locks/unix/global_mutex.c Wed Mar 25 09:07:34 2015
@@ -147,20 +147,22 @@ APR_DECLARE(apr_status_t) apr_global_mut
{
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) {