llvm-project/llvm/lib/Support/Windows
Greg Bedwell 7f68a71669 Fix rename() sometimes failing if another process uses openFileForRead()
On Windows, fs::rename() could fail is another process was reading the
file at the same time using fs::openFileForRead().  In most cases the user
wouldn't notice as fs::rename() will continue to retry for 2000ms.  Typically
this is enough for the read to complete and a retry to succeed, but if the
disk is being it too hard then the response time might be longer than the
retry time and the rename would fail with a permission error.

Add FILE_SHARE_DELETE to the sharing flags for CreateFileW() in
fs::openFileForRead() and try ReplaceFileW() prior to MoveFileExW()
in fs::rename().

Based on an initial patch by Edd Dawson!

Differential Revision: http://reviews.llvm.org/D13647

llvm-svn: 250046
2015-10-12 15:11:47 +00:00
..
COM.inc Windows/COM.inc: Fix emacs mode in the first line. 2015-08-05 06:11:08 +00:00
DynamicLibrary.inc [Support] Lazy load of dbghlp.dll on Windows 2015-07-02 14:34:57 +00:00
Host.inc Windows/Host.inc: Reformat the header to fit 80-col. 2014-09-24 04:45:14 +00:00
Memory.inc [Support] Fix a race initializing a static local in MSVC 2015-06-11 22:22:45 +00:00
Mutex.inc
Path.inc Fix rename() sometimes failing if another process uses openFileForRead() 2015-10-12 15:11:47 +00:00
Process.inc Replace windows_error calls with mapWindowsError. 2015-05-04 04:48:10 +00:00
Program.inc Windows: Fixed sys::findProgramByName to work with files containing dot in their name. 2015-10-08 16:03:19 +00:00
RWMutex.inc PR21202: Memory leak in Windows RWMutexImpl when using SRWLOCK 2014-10-21 00:34:39 +00:00
Signals.inc Rename RunCallBacksToRun to llvm::sys::RunSignalHandlers 2015-07-22 21:11:17 +00:00
ThreadLocal.inc ThreadLocal: Return a mutable pointer if templated with a non-const type 2014-12-15 01:04:45 +00:00
TimeValue.inc Fix lib\support\Windows/TimeValue.inc(48): warning C4189: 2015-04-15 07:45:52 +00:00
Watchdog.inc
WindowsSupport.h Removing LLVM_EXPLICIT, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition. 2015-02-15 22:00:20 +00:00
explicit_symbols.inc [Cygming] Seek also chkstk_ms, or JIT fails with DLL builds. It is fixup for r227519. 2015-01-30 13:01:19 +00:00