mirror of
https://github.com/boostorg/unordered.git
synced 2025-05-11 13:34:06 +00:00
Update test to spin until the container is non-empty
This commit is contained in:
parent
88d4d64edf
commit
2cf72093b1
@ -534,22 +534,25 @@ namespace {
|
||||
{
|
||||
map_type x(0, hasher(1), key_equal(2), allocator_type{});
|
||||
|
||||
auto f = [&x, &values, &m, &cv, &ready] {
|
||||
std::atomic_uint num_transfers{0};
|
||||
|
||||
std::thread t1([&x, &values] {
|
||||
for (auto const& val : values) {
|
||||
x.insert(val);
|
||||
}
|
||||
});
|
||||
|
||||
std::thread t2([&x, &m, &cv, &ready] {
|
||||
while (x.empty()) {
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(m);
|
||||
ready = true;
|
||||
}
|
||||
cv.notify_all();
|
||||
|
||||
for (auto const& val : values) {
|
||||
x.insert(val);
|
||||
}
|
||||
};
|
||||
|
||||
std::atomic_uint num_transfers{0};
|
||||
|
||||
std::thread t1(f);
|
||||
std::thread t2(f);
|
||||
});
|
||||
|
||||
thread_runner(
|
||||
values, [&x, &reference_map, &num_transfers, rg, &m, &ready, &cv](
|
||||
|
Loading…
x
Reference in New Issue
Block a user