diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-11-20 16:01:35 +0200 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2015-12-01 11:49:02 +0200 |
commit | 07c0424ab95a5e6b963c6a2f387adb9f2aa26c9b (patch) | |
tree | e21cee7404c1c90e927ddec131c8eb573046d215 /include/mbgl/util/run_loop.hpp | |
parent | a1f714bd373b1ab2836e69321944746b72fe1e37 (diff) | |
download | qtlocation-mapboxgl-07c0424ab95a5e6b963c6a2f387adb9f2aa26c9b.tar.gz |
[core] Removed libuv dependency from HTTPCurl*
Moved the fd watcher to the RunLoop. So far only needs to
be implemented by platforms using HTTPCurlRequest et al.
Diffstat (limited to 'include/mbgl/util/run_loop.hpp')
-rw-r--r-- | include/mbgl/util/run_loop.hpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index 122f90c3d7..85b8b8d665 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -2,6 +2,7 @@ #define MBGL_UTIL_RUN_LOOP #include <mbgl/util/noncopyable.hpp> +#include <mbgl/util/util.hpp> #include <mbgl/util/work_task.hpp> #include <mbgl/util/work_request.hpp> @@ -23,6 +24,13 @@ public: New, }; + enum class Event : uint8_t { + None = 0, + Read = 1, + Write = 2, + ReadWrite = Read | Write, + }; + RunLoop(Type type = Type::Default); ~RunLoop(); @@ -33,6 +41,10 @@ public: void runOnce(); void stop(); + // So far only needed by the libcurl backend. + void addWatch(int fd, Event, std::function<void(int, Event)>&& callback); + void removeWatch(int fd); + // Invoke fn(args...) on this RunLoop. template <class Fn, class... Args> void invoke(Fn&& fn, Args&&... args) { @@ -96,6 +108,8 @@ public: } private: + MBGL_STORE_THREAD(tid) + template <class F, class P> class Invoker : public WorkTask { public: |