mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-11 20:30:27 +02:00
test: Default initialize should_freeze
to true
It is safe now, when move semantics is used instead of a custom swap function.
This commit is contained in:
parent
cea50521fe
commit
95ad70ab65
@ -109,9 +109,7 @@ struct FrozenCleanupCheck {
|
|||||||
static std::atomic<uint64_t> nFrozen;
|
static std::atomic<uint64_t> nFrozen;
|
||||||
static std::condition_variable cv;
|
static std::condition_variable cv;
|
||||||
static std::mutex m;
|
static std::mutex m;
|
||||||
// Freezing can't be the default initialized behavior given how the queue
|
bool should_freeze{true};
|
||||||
// swaps in default initialized Checks.
|
|
||||||
bool should_freeze {false};
|
|
||||||
bool operator()() const
|
bool operator()() const
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -344,10 +342,6 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
|
|||||||
std::thread t0([&]() {
|
std::thread t0([&]() {
|
||||||
CCheckQueueControl<FrozenCleanupCheck> control(queue.get());
|
CCheckQueueControl<FrozenCleanupCheck> control(queue.get());
|
||||||
std::vector<FrozenCleanupCheck> vChecks(1);
|
std::vector<FrozenCleanupCheck> vChecks(1);
|
||||||
// Freezing can't be the default initialized behavior given how the queue
|
|
||||||
// swaps in default initialized Checks (otherwise freezing destructor
|
|
||||||
// would get called twice).
|
|
||||||
vChecks[0].should_freeze = true;
|
|
||||||
control.Add(std::move(vChecks));
|
control.Add(std::move(vChecks));
|
||||||
bool waitResult = control.Wait(); // Hangs here
|
bool waitResult = control.Wait(); // Hangs here
|
||||||
assert(waitResult);
|
assert(waitResult);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user