From 9ef6aa562abe8285e22d70fbc67978e56212f7e9 Mon Sep 17 00:00:00 2001 From: ArsenArsen Date: Thu, 20 Jul 2017 14:18:28 +0200 Subject: [PATCH] Fix a recording performance issue This is why dev is a thing --- worker/worker.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/worker/worker.cpp b/worker/worker.cpp index ec317cf..88c1e0a 100644 --- a/worker/worker.cpp +++ b/worker/worker.cpp @@ -58,13 +58,15 @@ bool Worker::ended() { void Worker::process() { while (!ended()) { - QMutexLocker ml(&lock); + lock.lock(); if (!qqueue.isEmpty()) { _WorkerContext *c = qqueue.dequeue(); + lock.unlock(); c->consumer(c->image.convertToFormat(c->targetFormat)); delete c->underlyingThing; delete c; - } + } else + lock.unlock(); std::this_thread::sleep_for(std::chrono::milliseconds(10)); // STL likes it's scopes } emit finished();