diff options
Diffstat (limited to 'include/mbgl/util/run_loop.hpp')
-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(); } } |