[clang-tools-extra] [NFC] Avoid data race condition. (PR #118664)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 9 13:19:14 PST 2024


================
@@ -501,6 +501,7 @@ class PreambleThread {
       }
 
       {
+        std::unique_lock<std::mutex> Lock(Mutex);
         WithContext Guard(std::move(CurrentReq->Ctx));
----------------
tahonermann wrote:

Per private discussion, we determined that there isn't actually a bug here so long as a `PreambleThread` object is only ever scheduled to run on one thread. That appears to be the case; the only instance of a `PreambleThread` object is the `PreamblePeer` member of `ASTWorker` and `ASTWorker::create()` only spawns one task to run `PreambleThread::run()`. I think this PR can be abandoned.

https://github.com/llvm/llvm-project/pull/118664


More information about the cfe-commits mailing list