diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2018-01-23 14:43:37 -0800 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2018-02-07 18:21:58 +0100 |
commit | 1eb628327d30031b3a2c6b9b8f9d14b6f5197b2f (patch) | |
tree | bc88dd3229248c12cbe7957cf1a7fe2ad2b7d46a | |
parent | 9b961fb6f9d1bdc9a5a8afe01162858d3ce2c39c (diff) | |
download | qtlocation-mapboxgl-1eb628327d30031b3a2c6b9b8f9d14b6f5197b2f.tar.gz |
[core] change RunLoop processing to check queue on every iteration
-rw-r--r-- | include/mbgl/util/run_loop.hpp | 13 |
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(); } } |