forked from OSchip/llvm-project
[ORC] Join materialization thread in unit test
There's are race between this thread and the destructor of the test ORC components on the main threads. I saw flaky failures there in about 4% of the runs of this unit test. llvm-svn: 328300
This commit is contained in:
parent
54634f1990
commit
fbd4df2176
|
@ -392,15 +392,15 @@ TEST(CoreAPIsTest, TestLookupWithThreadedMaterialization) {
|
||||||
|
|
||||||
ExecutionSession ES(SSP);
|
ExecutionSession ES(SSP);
|
||||||
|
|
||||||
auto MaterializeOnNewThread = [&ES](VSO &V,
|
std::thread MaterializationThread;
|
||||||
std::unique_ptr<MaterializationUnit> MU) {
|
auto MaterializeOnNewThread = [&](VSO &V,
|
||||||
|
std::unique_ptr<MaterializationUnit> MU) {
|
||||||
// FIXME: Use move capture once we move to C++14.
|
// FIXME: Use move capture once we move to C++14.
|
||||||
std::shared_ptr<MaterializationUnit> SharedMU = std::move(MU);
|
std::shared_ptr<MaterializationUnit> SharedMU = std::move(MU);
|
||||||
std::thread([&ES, &V, SharedMU]() {
|
MaterializationThread = std::thread([&ES, &V, SharedMU]() {
|
||||||
if (auto Err = SharedMU->materialize(V))
|
if (auto Err = SharedMU->materialize(V))
|
||||||
ES.reportError(std::move(Err));
|
ES.reportError(std::move(Err));
|
||||||
})
|
});
|
||||||
.detach();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
auto FooLookupResult =
|
auto FooLookupResult =
|
||||||
|
@ -410,6 +410,7 @@ TEST(CoreAPIsTest, TestLookupWithThreadedMaterialization) {
|
||||||
<< "lookup returned an incorrect address";
|
<< "lookup returned an incorrect address";
|
||||||
EXPECT_EQ(FooLookupResult.getFlags(), FooSym.getFlags())
|
EXPECT_EQ(FooLookupResult.getFlags(), FooSym.getFlags())
|
||||||
<< "lookup returned incorrect flags";
|
<< "lookup returned incorrect flags";
|
||||||
|
MaterializationThread.join();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue