Skip to content

Commit fda4300

Browse files
committed
[ORC] Fix race condtition in CoreAPIsTest.
This test has been failing intermittently on some builders, probably due to a race on the WorkThreads vector. This patch should fix that.
1 parent 7f0acc4 commit fda4300

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/unittests/ExecutionEngine/Orc/CoreAPIsTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,8 +1249,10 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithUnthreadedMaterialization) {
12491249
TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) {
12501250
#if LLVM_ENABLE_THREADS
12511251

1252+
std::mutex WorkThreadsMutex;
12521253
std::vector<std::thread> WorkThreads;
12531254
ES.setDispatchTask([&](std::unique_ptr<Task> T) {
1255+
std::lock_guard<std::mutex> Lock(WorkThreadsMutex);
12541256
WorkThreads.push_back(
12551257
std::thread([T = std::move(T)]() mutable { T->run(); }));
12561258
});

0 commit comments

Comments
 (0)