[llvm] 1a1d6e6 - [ORC] Add more synchronization to TestLookupWithUnthreadedMaterialization.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Sat May 22 07:59:43 PDT 2021
Author: Lang Hames
Date: 2021-05-22T07:59:24-07:00
New Revision: 1a1d6e6f98738be249b20994bcfed48dccac59e3
URL: https://github.com/llvm/llvm-project/commit/1a1d6e6f98738be249b20994bcfed48dccac59e3
DIFF: https://github.com/llvm/llvm-project/commit/1a1d6e6f98738be249b20994bcfed48dccac59e3.diff
LOG: [ORC] Add more synchronization to TestLookupWithUnthreadedMaterialization.
Don't run tasks until their corresponding thread has been added to the running
threads vector. This is an extention to fda4300da82, which doesn't seem to have
been enough to fix the synchronization issues on its own.
Added:
Modified:
llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
index 0dbbcb6f35d5..717987daa2ab 100644
--- a/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp
@@ -1252,9 +1252,14 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) {
std::mutex WorkThreadsMutex;
std::vector<std::thread> WorkThreads;
ES.setDispatchTask([&](std::unique_ptr<Task> T) {
+ std::promise<void> WaitP;
std::lock_guard<std::mutex> Lock(WorkThreadsMutex);
WorkThreads.push_back(
- std::thread([T = std::move(T)]() mutable { T->run(); }));
+ std::thread([T = std::move(T), WaitF = WaitP.get_future()]() mutable {
+ WaitF.get();
+ T->run();
+ }));
+ WaitP.set_value();
});
cantFail(JD.define(absoluteSymbols({{Foo, FooSym}})));
More information about the llvm-commits
mailing list