summaryrefslogtreecommitdiff
path: root/src/win32
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2017-04-03 23:07:16 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2017-04-03 23:14:24 +0100
commit7ece906598fff75ea0d0b73b7158c077e6654698 (patch)
treede76c7170cd5107921f8ed4edb6d60625e022ef1 /src/win32
parent1069ad3c54c9aab24f5d5a3c0a84c0b8a599b251 (diff)
downloadlibgit2-7ece906598fff75ea0d0b73b7158c077e6654698.tar.gz
win32: make posix emulation retries configurable
POSIX emulation retries should be configurable so that tests can disable them. In particular, maniacally threading tests may end up trying to open locked files and need retries, which will slow continuous integration tests significantly.
Diffstat (limited to 'src/win32')
-rw-r--r--src/win32/posix.h1
-rw-r--r--src/win32/posix_w32.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/src/win32/posix.h b/src/win32/posix.h
index 0ba05a16f..64769ecd3 100644
--- a/src/win32/posix.h
+++ b/src/win32/posix.h
@@ -15,6 +15,7 @@
#include "dir.h"
extern unsigned long git_win32__createfile_sharemode;
+extern int git_win32__retries;
typedef SOCKET GIT_SOCKET;
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index 874892eb6..bf132966d 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -37,6 +37,7 @@ typedef DWORD(WINAPI *PFGetFinalPathNameByHandleW)(HANDLE, LPWSTR, DWORD, DWORD)
unsigned long git_win32__createfile_sharemode =
FILE_SHARE_READ | FILE_SHARE_WRITE;
+int git_win32__retries = 10;
GIT_INLINE(void) set_errno(void)
{
@@ -162,7 +163,7 @@ GIT_INLINE(bool) last_error_retryable(void)
#define do_with_retries(fn, cleanup) \
do { \
int __tries, __ret; \
- for (__tries = 0; __tries < 10; __tries++) { \
+ for (__tries = 0; __tries < git_win32__retries; __tries++) { \
if (__tries && (__ret = (cleanup)) != 0) \
return __ret; \
if ((__ret = (fn)) != GIT_RETRY) \