summaryrefslogtreecommitdiff
path: root/platform/android/src/run_loop_impl.hpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-04-13 17:07:35 +0300
committerJohn Firebaugh <john.firebaugh@gmail.com>2016-04-14 13:44:08 -0700
commit40e590b681444a3726543689ee5f478f358357f6 (patch)
treed7dc2e72e530fb27e32445253529939b6d075b7c /platform/android/src/run_loop_impl.hpp
parent204c7fee032bf8509747046b43a788366a189ae7 (diff)
downloadqtlocation-mapboxgl-40e590b681444a3726543689ee5f478f358357f6.tar.gz
[android] Use ALooper_addFd() and callbacks to wake up
This is needed for plugging into an existing Looper because we won't call ::run() on the main thread (this is called on the Java side of the application automatically by Android). But we still need to wake up and process the events. For that we create a pipe and write to the pipe to wake up the main loop and we process events on the callback of the fd handler. Fixes #4682
Diffstat (limited to 'platform/android/src/run_loop_impl.hpp')
-rw-r--r--platform/android/src/run_loop_impl.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/platform/android/src/run_loop_impl.hpp b/platform/android/src/run_loop_impl.hpp
index 2dd912994f..5cf7231175 100644
--- a/platform/android/src/run_loop_impl.hpp
+++ b/platform/android/src/run_loop_impl.hpp
@@ -27,6 +27,11 @@ public:
std::list<Runnable*>::iterator iter;
};
+ Impl(RunLoop*, RunLoop::Type);
+ ~Impl();
+
+ void wake();
+
void addRunnable(Runnable*);
void removeRunnable(Runnable*);
void initRunnable(Runnable*);
@@ -36,6 +41,8 @@ public:
private:
friend RunLoop;
+ int fds[2];
+
JNIEnv *env = nullptr;
bool detach = false;