Changeset View
Changeset View
Standalone View
Standalone View
src/test/checkqueue_tests.cpp
Show First 20 Lines • Show All 379 Lines • ▼ Show 20 Lines | auto queue = | ||||
} | } | ||||
tg.join_all(); | tg.join_all(); | ||||
BOOST_REQUIRE_EQUAL(fails, 0); | BOOST_REQUIRE_EQUAL(fails, 0); | ||||
} | } | ||||
{ | { | ||||
boost::thread_group tg; | boost::thread_group tg; | ||||
std::mutex m; | std::mutex m; | ||||
std::condition_variable cv; | std::condition_variable cv; | ||||
{ | |||||
bool has_lock{false}; | bool has_lock{false}; | ||||
bool has_tried{false}; | bool has_tried{false}; | ||||
bool done{false}; | bool done{false}; | ||||
bool done_ack{false}; | bool done_ack{false}; | ||||
{ | |||||
std::unique_lock<std::mutex> l(m); | std::unique_lock<std::mutex> l(m); | ||||
tg.create_thread([&] { | tg.create_thread([&] { | ||||
CCheckQueueControl<FakeCheck> control(queue.get()); | CCheckQueueControl<FakeCheck> control(queue.get()); | ||||
std::unique_lock<std::mutex> ll(m); | std::unique_lock<std::mutex> ll(m); | ||||
has_lock = true; | has_lock = true; | ||||
cv.notify_one(); | cv.notify_one(); | ||||
cv.wait(ll, [&] { return has_tried; }); | cv.wait(ll, [&] { return has_tried; }); | ||||
done = true; | done = true; | ||||
Show All 23 Lines |