[clang-tools-extra] eb64dbd - [clangd] Fix flaky throttler test

Sam McCall via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 7 09:10:02 PDT 2022


Author: Sam McCall
Date: 2022-07-07T18:09:54+02:00
New Revision: eb64dbd6e0e617298579d32372fb92e595816d45

URL: https://github.com/llvm/llvm-project/commit/eb64dbd6e0e617298579d32372fb92e595816d45
DIFF: https://github.com/llvm/llvm-project/commit/eb64dbd6e0e617298579d32372fb92e595816d45.diff

LOG: [clangd] Fix flaky throttler test

The production code doesn't depend on the relative destruction order of
the throttle request and the main request, but the test does.

Added: 
    

Modified: 
    clang-tools-extra/clangd/TUScheduler.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/TUScheduler.cpp b/clang-tools-extra/clangd/TUScheduler.cpp
index a112b666e9ab..4c6c8c679be3 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -498,6 +498,8 @@ class PreambleThread {
         // Build the preamble and let the waiters know about it.
         build(std::move(*CurrentReq));
       }
+      // Releasing the throttle before destroying the request assists testing.
+      Throttle.reset();
       bool IsEmpty = false;
       {
         std::lock_guard<std::mutex> Lock(Mutex);


        


More information about the cfe-commits mailing list