diff options
author | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-02-06 16:51:01 +0100 |
---|---|---|
committer | Wladimir J. van der Laan <laanwj@gmail.com> | 2015-02-06 16:51:39 +0100 |
commit | fb6140b54bad51e3b063dfb005bfde13aca64eb4 (patch) | |
tree | be1accf03bc06675785a66072bfbaf56aaf5ffd9 /src | |
parent | 5d901d8ece9aa29dc1dcacc3f10f24321288b548 (diff) | |
parent | cf008ac8c3c5d582562d88ad89020daef3e64dcb (diff) |
Merge pull request #5721
cf008ac Acquire CCheckQueue's lock to avoid race condition (Suhas Daftuar)
Diffstat (limited to 'src')
-rw-r--r-- | src/checkqueue.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/checkqueue.h b/src/checkqueue.h index 7ca825c16f..6f6b97e3a7 100644 --- a/src/checkqueue.h +++ b/src/checkqueue.h @@ -161,7 +161,12 @@ public: { } - friend class CCheckQueueControl<T>; + bool IsIdle() + { + boost::unique_lock<boost::mutex> lock(mutex); + return (nTotal == nIdle && nTodo == 0 && fAllOk == true); + } + }; /** @@ -180,9 +185,8 @@ public: { // passed queue is supposed to be unused, or NULL if (pqueue != NULL) { - assert(pqueue->nTotal == pqueue->nIdle); - assert(pqueue->nTodo == 0); - assert(pqueue->fAllOk == true); + bool isIdle = pqueue->IsIdle(); + assert(isIdle); } } |