[llvm] 2b3aff8 - [ORC] Don't notify condition variable when condition is not met.

Lang Hames via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 22 17:55:18 PST 2024


Author: Lang Hames
Date: 2024-12-23T12:55:10+11:00
New Revision: 2b3aff8f92f8713c27791997df3ad5f2a8b51301

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

LOG: [ORC] Don't notify condition variable when condition is not met.

Avoids waking threads when the condition to proceed won't be met. NFC.

Added: 
    

Modified: 
    llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp b/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp
index b04d9cee2ceec5..fbe4b093b0c642 100644
--- a/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/TaskDispatch.cpp
@@ -68,7 +68,8 @@ void DynamicThreadPoolTaskDispatcher::dispatch(std::unique_ptr<Task> T) {
         if (IsMaterializationTask)
           --NumMaterializationThreads;
         --Outstanding;
-        OutstandingCV.notify_all();
+        if (Outstanding == 0)
+          OutstandingCV.notify_all();
         return;
       }
     }


        


More information about the llvm-commits mailing list