mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-26 03:55:08 +02:00
fix locking in GenericQueueThread::process
This commit is contained in:
parent
7064b29a2d
commit
13eddef312
1 changed files with 6 additions and 1 deletions
|
@ -45,18 +45,23 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual bool process() {
|
virtual bool process() {
|
||||||
|
lock();
|
||||||
if (!_items.size()) {
|
if (!_items.size()) {
|
||||||
|
unlock();
|
||||||
_hasItemsMutex.lock();
|
_hasItemsMutex.lock();
|
||||||
_hasItems.wait(&_hasItemsMutex, getMaxWait());
|
_hasItems.wait(&_hasItemsMutex, getMaxWait());
|
||||||
_hasItemsMutex.unlock();
|
_hasItemsMutex.unlock();
|
||||||
|
} else {
|
||||||
|
unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lock();
|
||||||
if (!_items.size()) {
|
if (!_items.size()) {
|
||||||
|
unlock();
|
||||||
return isStillRunning();
|
return isStillRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
Queue processItems;
|
Queue processItems;
|
||||||
lock();
|
|
||||||
processItems.swap(_items);
|
processItems.swap(_items);
|
||||||
unlock();
|
unlock();
|
||||||
return processQueueItems(processItems);
|
return processQueueItems(processItems);
|
||||||
|
|
Loading…
Reference in a new issue