Use a mutex locker.

I am currently working on another private project and that and the lack of the ability to reproduce some issues is why the development has slowed down
This commit is contained in:
ArsenArsen 2017-07-18 22:03:37 +02:00
parent 69ea0fb3ee
commit f509d44cca
1 changed files with 1 additions and 2 deletions

View File

@ -58,14 +58,13 @@ bool Worker::ended() {
void Worker::process() { void Worker::process() {
while (!ended()) { while (!ended()) {
lock.lock(); QMutexLocker ml(&lock);
if (!qqueue.isEmpty()) { if (!qqueue.isEmpty()) {
_WorkerContext *c = qqueue.dequeue(); _WorkerContext *c = qqueue.dequeue();
c->consumer(c->image.convertToFormat(c->targetFormat)); c->consumer(c->image.convertToFormat(c->targetFormat));
delete c->underlyingThing; delete c->underlyingThing;
delete c; delete c;
} }
lock.unlock();
std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes
} }
emit finished(); emit finished();