[clang] [clang][modules][deps] Add mutex as an alternative to file lock (PR #129751)
Michael Spencer via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 6 11:33:08 PST 2025
================
@@ -0,0 +1,39 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_SERIALIZATION_MODULECACHELOCK_H
+#define LLVM_CLANG_SERIALIZATION_MODULECACHELOCK_H
+
+#include "clang/Basic/LLVM.h"
+#include "llvm/Support/LockFileManager.h"
+
+namespace clang {
+enum class LockResult { Owned, Shared, Error };
+enum class WaitForUnlockResult { Success, OwnerDied, Timeout };
+
+class ModuleCacheLockManager {
+public:
+ virtual operator LockResult() const = 0;
+ virtual WaitForUnlockResult waitForUnlock() = 0;
----------------
Bigcheese wrote:
Looking more at how this is structured I think this should still have a timeout because of the LockFile implementation. And then it doesn't really hurt to actually do the timeout for the mutex impl, even though actually hitting that has other issues.
https://github.com/llvm/llvm-project/pull/129751
More information about the cfe-commits
mailing list