[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,66 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Tooling/DependencyScanning/ModuleCacheMutexLock.h"
+
+#include <mutex>
+
+using namespace clang;
+using namespace tooling;
+using namespace dependencies;
+
+namespace {
+struct ModuleCacheMutexLockManager : ModuleCacheLockManager {
+ std::unique_lock<std::shared_mutex> OwningLock;
----------------
Bigcheese wrote:
Can you add a comment here saying something like:
TODO: Consider using std::atomic::{wait, notify_all} when LLVM moves to C++20.
This is the actual operation we want to use, which lowers to futex/ulock.
https://github.com/llvm/llvm-project/pull/129751
More information about the cfe-commits
mailing list