From: Kadir Cetinkaya Date: Thu, 18 Aug 2022 16:34:21 +0000 (+0200) Subject: [clangd] Fix a tsan failure in PreambleThrottle tests X-Git-Tag: upstream/17.0.6~36135 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7f2a079a122b5f3abd4afa6697e951616dca768b;p=platform%2Fupstream%2Fllvm.git [clangd] Fix a tsan failure in PreambleThrottle tests --- diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp index 33c92b3..fd56b0d 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 Lock(Mu); + if (Notify && ID == Notify->first) { + Notify->second->notify(); + Notify.reset(); + } } return ID; }