apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r1791932 - in /apr/apr/branches/1.6.x: CHANGES configure.in include/apr.h.in locks/unix/global_mutex.c locks/unix/proc_mutex.c locks/unix/thread_mutex.c test/testlock.c test/testprocmutex.c
Date Wed, 19 Apr 2017 15:25:28 GMT
Author: niq
Date: Wed Apr 19 15:25:28 2017
New Revision: 1791932

URL: http://svn.apache.org/viewvc?rev=1791932&view=rev
Log:
Make timedlocks a configuration option.
After first Mac then Solaris biting us, timedlocks look high-risk,
so a config option and a corresponding rlease note offer a workaround
to any users who get bitten.

Modified:
    apr/apr/branches/1.6.x/CHANGES
    apr/apr/branches/1.6.x/configure.in
    apr/apr/branches/1.6.x/include/apr.h.in
    apr/apr/branches/1.6.x/locks/unix/global_mutex.c
    apr/apr/branches/1.6.x/locks/unix/proc_mutex.c
    apr/apr/branches/1.6.x/locks/unix/thread_mutex.c
    apr/apr/branches/1.6.x/test/testlock.c
    apr/apr/branches/1.6.x/test/testprocmutex.c

Modified: apr/apr/branches/1.6.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/CHANGES?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.6.x/CHANGES [utf-8] Wed Apr 19 15:25:28 2017
@@ -1,6 +1,8 @@
                                                      -*- coding: utf-8 -*-
 Changes for APR 1.6.1
 
+  *) Locks: add a --disable-timedlocks config option in case users
+     encounter more platforms where it fails [Nick Kew].
 
 Changes for APR 1.6.0
 

Modified: apr/apr/branches/1.6.x/configure.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/configure.in?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/configure.in (original)
+++ apr/apr/branches/1.6.x/configure.in Wed Apr 19 15:25:28 2017
@@ -2789,6 +2789,12 @@ AC_MSG_RESULT($ipv6_result)
 
 AC_SUBST(have_ipv6)
 
+AC_ARG_ENABLE(timedlocks,
+  [  --disable-timedlocks	  Disable timed locks ],
+  [apr_has_timedlocks="0"], [apr_has_timedlocks="1"]
+)
+AC_SUBST(apr_has_timedlocks)
+
 # hstrerror is only needed if IPv6 is not enabled,
 # so getaddrinfo/gai_strerror are not used.
 if test $have_ipv6 = 0; then

Modified: apr/apr/branches/1.6.x/include/apr.h.in
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/include/apr.h.in?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/include/apr.h.in (original)
+++ apr/apr/branches/1.6.x/include/apr.h.in Wed Apr 19 15:25:28 2017
@@ -280,6 +280,7 @@ extern "C" {
 #define APR_HAS_LARGE_FILES       @aprlfs@
 #define APR_HAS_XTHREAD_FILES     @apr_has_xthread_files@
 #define APR_HAS_OS_UUID           @osuuid@
+#define APR_HAS_TIMEDLOCKS        @apr_has_timedlocks@
 
 #define APR_PROCATTR_USER_SET_REQUIRES_PASSWORD @apr_procattr_user_set_requires_password@
 

Modified: apr/apr/branches/1.6.x/locks/unix/global_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/locks/unix/global_mutex.c?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/locks/unix/global_mutex.c (original)
+++ apr/apr/branches/1.6.x/locks/unix/global_mutex.c Wed Apr 19 15:25:28 2017
@@ -145,6 +145,7 @@ APR_DECLARE(apr_status_t) apr_global_mut
 APR_DECLARE(apr_status_t) apr_global_mutex_timedlock(apr_global_mutex_t *mutex,
                                                  apr_interval_time_t timeout)
 {
+#if APR_HAS_TIMEDLOCKS
     apr_status_t rv;
 
 #if APR_HAS_THREADS
@@ -177,6 +178,9 @@ APR_DECLARE(apr_status_t) apr_global_mut
 #endif /* APR_HAS_THREADS */
 
     return rv;
+#else  /* APR_HAS_TIMEDLOCKS */
+    return APR_ENOTIMPL;
+#endif
 }
 
 APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex)

Modified: apr/apr/branches/1.6.x/locks/unix/proc_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/locks/unix/proc_mutex.c?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/locks/unix/proc_mutex.c (original)
+++ apr/apr/branches/1.6.x/locks/unix/proc_mutex.c Wed Apr 19 15:25:28 2017
@@ -1560,7 +1560,11 @@ APR_DECLARE(apr_status_t) apr_proc_mutex
 APR_DECLARE(apr_status_t) apr_proc_mutex_timedlock(apr_proc_mutex_t *mutex,
                                                apr_interval_time_t timeout)
 {
+#if APR_HAS_TIMEDLOCKS
     return mutex->meth->timedacquire(mutex, timeout);
+#else
+    return APR_ENOTIMPL;
+#endif
 }
 
 APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex)

Modified: apr/apr/branches/1.6.x/locks/unix/thread_mutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/locks/unix/thread_mutex.c?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/locks/unix/thread_mutex.c (original)
+++ apr/apr/branches/1.6.x/locks/unix/thread_mutex.c Wed Apr 19 15:25:28 2017
@@ -193,6 +193,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
                                                  apr_interval_time_t timeout)
 {
     apr_status_t rv = APR_ENOTIMPL;
+#if APR_HAS_TIMEDLOCKS
 
 #ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK
     if (timeout <= 0) {
@@ -269,6 +270,7 @@ APR_DECLARE(apr_status_t) apr_thread_mut
 
 #endif /* HAVE_PTHREAD_MUTEX_TIMEDLOCK */
 
+#endif /* APR_HAS_TIMEDLOCKS */
     return rv;
 }
 

Modified: apr/apr/branches/1.6.x/test/testlock.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/test/testlock.c?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/test/testlock.c (original)
+++ apr/apr/branches/1.6.x/test/testlock.c Wed Apr 19 15:25:28 2017
@@ -392,12 +392,16 @@ abts_suite *testlock(abts_suite *suite)
     abts_run_test(suite, threads_not_impl, NULL);
 #else
     abts_run_test(suite, test_thread_mutex, NULL);
+#if APR_HAS_TIMEDLOCKS
     abts_run_test(suite, test_thread_timedmutex, NULL);
+#endif
     abts_run_test(suite, test_thread_rwlock, NULL);
     abts_run_test(suite, test_cond, NULL);
     abts_run_test(suite, test_timeoutcond, NULL);
+#if APR_HAS_TIMEDLOCKS
     abts_run_test(suite, test_timeoutmutex, NULL);
 #endif
+#endif
 
     return suite;
 }

Modified: apr/apr/branches/1.6.x/test/testprocmutex.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.6.x/test/testprocmutex.c?rev=1791932&r1=1791931&r2=1791932&view=diff
==============================================================================
--- apr/apr/branches/1.6.x/test/testprocmutex.c (original)
+++ apr/apr/branches/1.6.x/test/testprocmutex.c Wed Apr 19 15:25:28 2017
@@ -184,6 +184,7 @@ static void test_exclusive(abts_case *tc
                     *x == MAX_COUNTER);
     }
 
+#if APR_HAS_TIMEDLOCKS
     rv = apr_proc_mutex_timedlock(proc_lock, 1);
     if (rv == APR_ENOTIMPL) {
         fprintf(stderr, "%s_timedlock() not implemented, ", mech->name);
@@ -220,6 +221,7 @@ static void test_exclusive(abts_case *tc
         ABTS_ASSERT(tc, "Locks don't appear to work with timedlock",
                     *x == MAX_COUNTER);
     }
+#endif  /* APR_HAS_TIMEDLOCKS */
 }
 
 static void proc_mutex(abts_case *tc, void *data)



Mime
View raw message