[PATCH] D40328: Use a single file name to represent a lock

Rafael Ávila de Espíndola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 21 18:09:05 PST 2017


rafael created this revision.

Currently the lock logic is

- Create a temp file
- Create a symbolic link on unix or a hard link on windows
- Delete both when we are done with it

The problem is that CreateHardLink on windows will fail if the file has a DeleteFile disposition which I want to use in TempFile.

The solution I think is to use a single file for the lock. On windows that is simple as rename can be set to fail if the destination exists.

On posix we first create the link as we do now, but immediately rename the original file onto it.


https://reviews.llvm.org/D40328

Files:
  include/llvm/Support/FileSystem.h
  lib/Support/LockFileManager.cpp
  lib/Support/Path.cpp
  lib/Support/Unix/Path.inc
  lib/Support/Windows/Path.inc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40328.123872.patch
Type: text/x-patch
Size: 5470 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171122/88628160/attachment.bin>


More information about the llvm-commits mailing list