[PATCH] D38570: Support: Rewrite Windows implementation of sys::fs::rename to be more POSIXy.

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 5 11:27:47 PDT 2017


On Thu, Oct 5, 2017 at 10:51 AM, Zachary Turner <zturner at google.com> wrote:

> What I mean is that you could have a system-wide named mutex with a unique
> name that involves a 128-bit GUID or something.  All ThinLTO linker
> processes could agree on this name from now until forever.  This would
> presist across linker invocations because the name of the mutex never
> changes.  This would synchronize access to a single "cache control file"
> that also had a globally unique (and unchanging) name.  So the algorithm
> for opening a file from the cache is:
>
> 1) Acquire the mutex
> 2) Try to open the file and either succeed or fail
> 3) Close the mutex.
>
> and the algorithm for adding a new file to the cache is:
>
> 1) Acquire the mutex
> 2) Do whatever it takes to get a new file into the cache
> 3) Close the mutex
>
> This should never race.
>

This patch makes our rename more POSIX-y. That seems like an objectively
good thing, regardless of what the best way to implement a shared,
persistent cache is on Windows. In the long run, this sounds like something
that could replace LLVM's probably hopelessly broken lock file
implementation on Windows.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171005/e1f2a9a3/attachment.html>


More information about the llvm-commits mailing list