summaryrefslogtreecommitdiff
path: root/platform/android/src/run_loop.cpp
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2017-10-10 15:39:07 +0200
committerKonstantin Käfer <mail@kkaefer.com>2017-10-10 19:34:36 +0200
commit329282fa574670c54f580ddebbc3b9f97161171b (patch)
tree144eb1312e8e605e8225f0e5e2355c9c7e0b6a9c /platform/android/src/run_loop.cpp
parentb820a3031885e6b2df987dc71d1b4562b7ca25f2 (diff)
downloadqtlocation-mapboxgl-329282fa574670c54f580ddebbc3b9f97161171b.tar.gz
[core] Allow pausing RunLoopsupstream/prioritize-thread-pause-resume
Previously we had the capability to pause on the Thread object, which used regular tasks to pause the RunLoop by blocking it. Instead, we can now pause the entire RunLoop and prevent it from processing items. This means that a pause() call is no longer treated as a regular task. Instead, it will take precedence over scheduled tasks, which means that a pause() call takes effect much more instantly since the RunLoop doesn't process the queue before the pause() task. Having pause() take effect much quicker is useful for situations where stopping the loop quickly is important, e.g. when the application goes to the background on iOS, and we have to stop processing tasks that access the file system. It also reduces the length of the blocking pause() call since the time until the RunLoop is paused is shortened.
Diffstat (limited to 'platform/android/src/run_loop.cpp')
-rw-r--r--platform/android/src/run_loop.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/platform/android/src/run_loop.cpp b/platform/android/src/run_loop.cpp
index dff7d1d984..34366d836a 100644
--- a/platform/android/src/run_loop.cpp
+++ b/platform/android/src/run_loop.cpp
@@ -216,8 +216,7 @@ LOOP_HANDLE RunLoop::getLoopHandle() {
return Get()->impl.get();
}
-void RunLoop::push(std::shared_ptr<WorkTask> task) {
- withMutex([&] { queue.push(std::move(task)); });
+void RunLoop::wake() {
impl->wake();
}