[PATCH] D79066: [Support] Class to facilitate file locking
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 28 23:10:48 PDT 2020
dblaikie added inline comments.
================
Comment at: llvm/include/llvm/Support/FileSystem.h:1168
+/// RAII class that facilitates file locking.
+class FileLocker {
+ int FD; ///< Locked file handle.
----------------
Perhaps this type should be boolean testable (for the error), or using a factory function to create one that returns llvm::Error (wrapped around the error_code) on failure:
```
{
Expected<FileLocker> F = TryLock(FD, Timeout);
if (!F) {
}
...
}
```
Hmm - if unlocking can fail, and that failure needs to be handled, this doesn't seem suitable for an RAII type device...
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79066/new/
https://reviews.llvm.org/D79066
More information about the llvm-commits
mailing list