Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
fbc6910f
Commit
fbc6910f
authored
Apr 01, 2017
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32: teach p_open about do_with_retries
parent
a0f67e4a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
src/win32/posix_w32.c
+12
-21
No files found.
src/win32/posix_w32.c
View file @
fbc6910f
...
...
@@ -438,14 +438,19 @@ int p_symlink(const char *old, const char *new)
return
git_futils_fake_symlink
(
old
,
new
);
}
GIT_INLINE
(
int
)
open_once
(
const
wchar_t
*
path
,
int
flags
,
mode_t
mode
)
{
int
ret
=
_wopen
(
path
,
flags
,
mode
);
return
(
ret
<
0
&&
last_error_retryable
())
?
GIT_RETRY
:
ret
;
}
int
p_open
(
const
char
*
path
,
int
flags
,
...)
{
git_win32_path
buf
;
git_win32_path
wpath
;
mode_t
mode
=
0
;
int
open_tries
;
int
handle
;
if
(
git_win32_path_from_utf8
(
buf
,
path
)
<
0
)
if
(
git_win32_path_from_utf8
(
wpath
,
path
)
<
0
)
return
-
1
;
if
(
flags
&
O_CREAT
)
{
...
...
@@ -456,23 +461,9 @@ int p_open(const char *path, int flags, ...)
va_end
(
arg_list
);
}
/* wait up to 50ms if file is locked by another thread or process */
open_tries
=
0
;
while
(
open_tries
<
10
)
{
handle
=
_wopen
(
buf
,
flags
|
STANDARD_OPEN_FLAGS
,
mode
&
WIN32_MODE_MASK
);
if
(
handle
!=
-
1
)
{
break
;
}
if
(
errno
==
EACCES
)
{
Sleep
(
5
);
open_tries
++
;
}
else
{
break
;
}
}
return
handle
;
do_with_retries
(
open_once
(
wpath
,
flags
|
STANDARD_OPEN_FLAGS
,
mode
&
WIN32_MODE_MASK
),
0
);
}
int
p_creat
(
const
char
*
path
,
mode_t
mode
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment