Test if being the kind of program that calls yield() pays dividends for flaky CI failures

This commit is contained in:
Christian Mazakas
2023-05-02 15:44:21 -07:00
parent 2ea0dbf30e
commit a9bf367d6e

View File

@ -191,6 +191,7 @@ namespace {
if (idx % 100 == 0) { if (idx % 100 == 0) {
cv.notify_all(); cv.notify_all();
} }
std::this_thread::yield();
} }
done1 = true; done1 = true;
@ -201,6 +202,7 @@ namespace {
for (auto const& val : vals2) { for (auto const& val : vals2) {
x2.insert(val); x2.insert(val);
std::this_thread::yield();
} }
done2 = true; done2 = true;
@ -214,6 +216,7 @@ namespace {
} }
x1.swap(x2); x1.swap(x2);
++num_swaps; ++num_swaps;
std::this_thread::yield();
} while (!done1 && !done2); } while (!done1 && !done2);
}); });