#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
+extern bool fShutdown;
+
template<typename T> class CCheckQueueControl;
/** Queue for verifications that have to be performed.
if (fOk)
fOk = check();
vChecks.clear();
- } while(true);
+ } while(true && !fShutdown); // HACK: force queue to shut down
+ return false;
}
public:
condQuit.wait(lock);
}
- friend class CCheckQueueControl<T>;
+ ~CCheckQueue() {
+ Quit();
+ }
+
+ bool IsIdle()
+ {
+ boost::unique_lock<boost::mutex> lock(mutex);
+ return (nTotal == nIdle && nTodo == 0 && fAllOk == true);
+ }
};
/** RAII-style controller object for a CCheckQueue that guarantees the passed
CCheckQueueControl(CCheckQueue<T> *pqueueIn) : pqueue(pqueueIn), fDone(false) {
// 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);
}
}