mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-06 18:01:03 +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::condition_variable cv;
|
||||
static std::mutex m;
|
||||
// Freezing can't be the default initialized behavior given how the queue
|
||||
// swaps in default initialized Checks.
|
||||
bool should_freeze {false};
|
||||
bool should_freeze{true};
|
||||
bool operator()() const
|
||||
{
|
||||
return true;
|
||||
@ -344,10 +342,6 @@ BOOST_AUTO_TEST_CASE(test_CheckQueue_FrozenCleanup)
|
||||
std::thread t0([&]() {
|
||||
CCheckQueueControl<FrozenCleanupCheck> control(queue.get());
|
||||
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));
|
||||
bool waitResult = control.Wait(); // Hangs here
|
||||
assert(waitResult);
|
||||
|
Loading…
x
Reference in New Issue
Block a user