fix locking in GenericQueueThread::process

This commit is contained in:
Seth Alves 2016-03-25 11:37:04 -07:00
parent 7064b29a2d
commit 13eddef312

View file

@ -45,18 +45,23 @@ protected:
}
virtual bool process() {
lock();
if (!_items.size()) {
unlock();
_hasItemsMutex.lock();
_hasItems.wait(&_hasItemsMutex, getMaxWait());
_hasItemsMutex.unlock();
} else {
unlock();
}
lock();
if (!_items.size()) {
unlock();
return isStillRunning();
}
Queue processItems;
lock();
processItems.swap(_items);
unlock();
return processQueueItems(processItems);