1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[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:
Benjamin Kramer 2018-03-23 10:14:19 +00:00
parent 577ce0d4e0
commit 6ec49c0ba8

View File

@ -392,15 +392,15 @@ TEST(CoreAPIsTest, TestLookupWithThreadedMaterialization) {
ExecutionSession ES(SSP);
auto MaterializeOnNewThread = [&ES](VSO &V,
std::unique_ptr<MaterializationUnit> MU) {
std::thread MaterializationThread;
auto MaterializeOnNewThread = [&](VSO &V,
std::unique_ptr<MaterializationUnit> MU) {
// FIXME: Use move capture once we move to C++14.
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))
ES.reportError(std::move(Err));
})
.detach();
});
};
auto FooLookupResult =
@ -410,6 +410,7 @@ TEST(CoreAPIsTest, TestLookupWithThreadedMaterialization) {
<< "lookup returned an incorrect address";
EXPECT_EQ(FooLookupResult.getFlags(), FooSym.getFlags())
<< "lookup returned incorrect flags";
MaterializationThread.join();
#endif
}