Merge pull request #5721

cf008ac Acquire CCheckQueue's lock to avoid race condition (Suhas Daftuar)
This commit is contained in:
Wladimir J. van der Laan 2015-02-06 16:51:01 +01:00
commit fb6140b54b
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6

View File

@ -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);
}
}