[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.
This commit is contained in:
Lang Hames 2021-05-21 20:50:22 -07:00
parent 7f0acc4e4f
commit fda4300da8

View File

@ -1249,8 +1249,10 @@ TEST_F(CoreAPIsStandardTest, TestLookupWithUnthreadedMaterialization) {
TEST_F(CoreAPIsStandardTest, TestLookupWithThreadedMaterialization) {
#if LLVM_ENABLE_THREADS
std::mutex WorkThreadsMutex;
std::vector<std::thread> WorkThreads;
ES.setDispatchTask([&](std::unique_ptr<Task> T) {
std::lock_guard<std::mutex> Lock(WorkThreadsMutex);
WorkThreads.push_back(
std::thread([T = std::move(T)]() mutable { T->run(); }));
});