You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by bl...@apache.org on 2011/01/26 22:05:06 UTC

svn commit: r1063870 - /subversion/trunk/subversion/libsvn_subr/io.c

Author: blair
Date: Wed Jan 26 21:05:06 2011
New Revision: 1063870

URL: http://svn.apache.org/viewvc?rev=1063870&view=rev
Log:
To prepare svn_io_file_lock2() to retry apr_file_lock() if it returns
EDEADLK, pull the constants out of WIN32_RETRY_LOOP so they can be
reused for svn_io_file_lock2(), thereby sharing the same retry
characteristics.

See this thread on why I'm doing this:

http://mail-archives.apache.org/mod_mbox/subversion-dev/201101.mbox/%3C4D3FC68F.7020709@orcaware.com%3E

* subversion/libsvn_subr/io.c
  (RETRY_MAX_ATTEMPTS),
  (RETRY_INITIAL_SLEEP),
  (RETRY_MAX_SLEEP):
    New #define's, values pulled from...
  (WIN32_RETRY_LOOP):
    ...this macro.

Modified:
    subversion/trunk/subversion/libsvn_subr/io.c

Modified: subversion/trunk/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/io.c?rev=1063870&r1=1063869&r2=1063870&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/io.c (original)
+++ subversion/trunk/subversion/libsvn_subr/io.c Wed Jan 26 21:05:06 2011
@@ -81,22 +81,27 @@
   retry loop cannot completely solve this problem either, but can
   help mitigate it.
 */
+#define RETRY_MAX_ATTEMPTS 100
+#define RETRY_INITIAL_SLEEP 1000
+#define RETRY_MAX_SLEEP 128000
+
 #ifndef WIN32_RETRY_LOOP
 #if defined(WIN32) && !defined(SVN_NO_WIN32_RETRY_LOOP)
 #define WIN32_RETRY_LOOP(err, expr)                                        \
   do                                                                       \
     {                                                                      \
       apr_status_t os_err = APR_TO_OS_ERROR(err);                          \
-      int sleep_count = 1000;                                              \
+      int sleep_count = RETRY_INITIAL_SLEEP;                               \
       int retries;                                                         \
       for (retries = 0;                                                    \
-           retries < 100 && (os_err == ERROR_ACCESS_DENIED                 \
-                             || os_err == ERROR_SHARING_VIOLATION          \
-                             || os_err == ERROR_DIR_NOT_EMPTY);            \
+           retries < RETRY_MAX_ATTEMPTS &&                                 \
+           (os_err == ERROR_ACCESS_DENIED                                  \
+            || os_err == ERROR_SHARING_VIOLATION                           \
+            || os_err == ERROR_DIR_NOT_EMPTY);                             \
            ++retries, os_err = APR_TO_OS_ERROR(err))                       \
         {                                                                  \
           apr_sleep(sleep_count);                                          \
-          if (sleep_count < 128000)                                        \
+          if (sleep_count < RETRY_MAX_SLEEP)                               \
             sleep_count *= 2;                                              \
           (err) = (expr);                                                  \
         }                                                                  \