[clang-tools-extra] 7f2a079 - [clangd] Fix a tsan failure in PreambleThrottle tests
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 18 09:36:13 PDT 2022
Author: Kadir Cetinkaya
Date: 2022-08-18T18:36:01+02:00
New Revision: 7f2a079a122b5f3abd4afa6697e951616dca768b
URL: https://github.com/llvm/llvm-project/commit/7f2a079a122b5f3abd4afa6697e951616dca768b
DIFF: https://github.com/llvm/llvm-project/commit/7f2a079a122b5f3abd4afa6697e951616dca768b.diff
LOG: [clangd] Fix a tsan failure in PreambleThrottle tests
Added:
Modified:
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 33c92b3425e8..fd56b0d75ae2 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -1401,9 +1401,12 @@ TEST_F(TUSchedulerTests, PreambleThrottle) {
}
if (Invoke)
Invoke();
- if (Notify && ID == Notify->first) {
- Notify->second->notify();
- Notify.reset();
+ {
+ std::lock_guard<std::mutex> Lock(Mu);
+ if (Notify && ID == Notify->first) {
+ Notify->second->notify();
+ Notify.reset();
+ }
}
return ID;
}
More information about the cfe-commits
mailing list