summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-01-23 14:43:37 -0800
committerKonstantin Käfer <mail@kkaefer.com>2018-02-07 18:21:58 +0100
commit1eb628327d30031b3a2c6b9b8f9d14b6f5197b2f (patch)
treebc88dd3229248c12cbe7957cf1a7fe2ad2b7d46a
parent9b961fb6f9d1bdc9a5a8afe01162858d3ce2c39c (diff)
downloadqtlocation-mapboxgl-1eb628327d30031b3a2c6b9b8f9d14b6f5197b2f.tar.gz
[core] change RunLoop processing to check queue on every iteration
-rw-r--r--include/mbgl/util/run_loop.hpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp
index ecb18c857b..7167652687 100644
--- a/include/mbgl/util/run_loop.hpp
+++ b/include/mbgl/util/run_loop.hpp
@@ -88,12 +88,13 @@ private:
void process() {
std::unique_lock<std::mutex> lock(mutex);
- Queue queue_;
- lock.unlock();
-
- while (!queue_.empty()) {
- (*(queue_.front()))();
- queue_.pop();
+ std::shared_ptr<WorkTask> task;
+ while (!queue.empty()) {
+ task = std::move(queue.front());
+ queue.pop();
+ lock.unlock();
+ (*task)();
+ lock.lock();
}
}