summaryrefslogtreecommitdiff
path: root/platform/android/src/run_loop_impl.hpp
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-07-06 16:57:20 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-07-06 17:43:19 +0300
commit480e26c53f48900c5a1bd65aac7411144043cc24 (patch)
tree61cf455917385ec5c4963075a7af18e5a87a6bb1 /platform/android/src/run_loop_impl.hpp
parent2425cf4ef839bbeec82403ea0bf8b74e68ca0ac8 (diff)
downloadqtlocation-mapboxgl-480e26c53f48900c5a1bd65aac7411144043cc24.tar.gz
[android] Add support for timers on the main thread
Wake up the main thread run loop with a file descriptor event from a thread that exists for this sole purpose.
Diffstat (limited to 'platform/android/src/run_loop_impl.hpp')
-rw-r--r--platform/android/src/run_loop_impl.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/platform/android/src/run_loop_impl.hpp b/platform/android/src/run_loop_impl.hpp
index cb553d1f8a..121a5127d1 100644
--- a/platform/android/src/run_loop_impl.hpp
+++ b/platform/android/src/run_loop_impl.hpp
@@ -5,6 +5,7 @@
#include <mbgl/util/atomic.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/run_loop.hpp>
+#include <mbgl/util/thread.hpp>
#include <list>
#include <memory>
@@ -15,6 +16,8 @@ struct ALooper;
namespace mbgl {
namespace util {
+class Alarm;
+
class RunLoop::Impl {
public:
class Runnable {
@@ -50,6 +53,8 @@ private:
JNIEnv *env = nullptr;
bool detach = false;
+ std::unique_ptr<Thread<Alarm>> alarm;
+
std::recursive_mutex mtx;
std::list<Runnable*> runnables;
std::list<Runnable*>::iterator nextRunnable;