Skip to content

Commit

Permalink
refactor: Use member initializers in CCheckQueue
Browse files Browse the repository at this point in the history
Summary:
This is a backport of [[bitcoin/bitcoin#18710 | core#18710]] [1/4]
bitcoin/bitcoin@0ef9386

Test Plan: `ninja all check-all`

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D10985
  • Loading branch information
hebasto authored and PiRK committed Feb 4, 2022
1 parent fa7a44f commit 83a6f76
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/checkqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,23 @@ template <typename T> class CCheckQueue {
std::vector<T> queue;

//! The number of workers (including the master) that are idle.
int nIdle;
int nIdle{0};

//! The total number of workers (including the master).
int nTotal;
int nTotal{0};

//! The temporary evaluation result.
bool fAllOk;
bool fAllOk{true};

/**
* Number of verifications that haven't completed yet.
* This includes elements that are no longer queued, but still in the
* worker's own batches.
*/
unsigned int nTodo;
unsigned int nTodo{0};

//! The maximum number of elements to be processed in one batch
unsigned int nBatchSize;
const unsigned int nBatchSize;

/** Internal function that does bulk of the verification work. */
bool Loop(bool fMaster = false) {
Expand Down Expand Up @@ -135,8 +135,7 @@ template <typename T> class CCheckQueue {

//! Create a new check queue
explicit CCheckQueue(unsigned int nBatchSizeIn)
: nIdle(0), nTotal(0), fAllOk(true), nTodo(0),
nBatchSize(nBatchSizeIn) {}
: nBatchSize(nBatchSizeIn) {}

//! Worker thread
void Thread() { Loop(); }
Expand Down

0 comments on commit 83a6f76

Please sign in to comment.