You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2012/10/02 20:05:02 UTC

svn commit: r1393066 - in /subversion/trunk/subversion: include/private/svn_dep_compat.h libsvn_subr/cache-membuffer.c

Author: stefan2
Date: Tue Oct  2 18:05:02 2012
New Revision: 1393066

URL: http://svn.apache.org/viewvc?rev=1393066&view=rev
Log:
Fix test failure on Windows caused by lock timeouts.  The root cause is
that APR_STATUS_IS_EBUSY does not work for apr_thread_rwlock_trywrlock
on Windows.  Therefore, we need to grow our own macro for lock-related
conditions.

* subversion/include/private/svn_dep_compat.h
  (SVN_LOCK_IS_BUSY): new define to replace APR_STATUS_IS_EBUSY on locks
* subversion/libsvn_subr/cache-membuffer.c
  (write_lock_cache): use our portable macro

Modified:
    subversion/trunk/subversion/include/private/svn_dep_compat.h
    subversion/trunk/subversion/libsvn_subr/cache-membuffer.c

Modified: subversion/trunk/subversion/include/private/svn_dep_compat.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/include/private/svn_dep_compat.h?rev=1393066&r1=1393065&r2=1393066&view=diff
==============================================================================
--- subversion/trunk/subversion/include/private/svn_dep_compat.h (original)
+++ subversion/trunk/subversion/include/private/svn_dep_compat.h Tue Oct  2 18:05:02 2012
@@ -87,6 +87,21 @@ typedef apr_uint32_t apr_uintptr_t;
 #endif /* !APR_VERSION_AT_LEAST(1,3,0) */
 
 /**
+ * Work around a platform dependency issue. apr_thread_rwlock_trywrlock()
+ * will make APR_STATUS_IS_EBUSY() return TRUE if the lock could not be
+ * acquired under Unix. Under Windows, this will not work. So, provide
+ * a more portable substitute.
+ *
+ * @since New in 1.8.
+ */
+#if APR_HAVE_WINDOWS_H
+#define SVN_LOCK_IS_BUSY(x) \
+    (APR_STATUS_IS_EBUSY(x) || (x) == APR_FROM_OS_ERROR(WAIT_TIMEOUT))
+#else
+#define SVN_LOCK_IS_BUSY(x) APR_STATUS_IS_EBUSY(x)
+#endif
+
+/**
  * Check at compile time if the Serf version is at least a certain
  * level.
  * @param major The major version component of the version checked

Modified: subversion/trunk/subversion/libsvn_subr/cache-membuffer.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/cache-membuffer.c?rev=1393066&r1=1393065&r2=1393066&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/cache-membuffer.c (original)
+++ subversion/trunk/subversion/libsvn_subr/cache-membuffer.c Tue Oct  2 18:05:02 2012
@@ -508,7 +508,7 @@ write_lock_cache(svn_membuffer_t *cache,
       else
         {
           status = apr_thread_rwlock_trywrlock(cache->lock);
-          if (APR_STATUS_IS_EBUSY(status))
+          if (SVN_LOCK_IS_BUSY(status))
             {
               *success = FALSE;
               status = APR_SUCCESS;