diff options
-rw-r--r-- | include/mbgl/util/run_loop.hpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index c89b8bd795..4bf614c55f 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -48,14 +48,12 @@ public: void runOnce(); void stop(); - using PlatformCallback = std::function<void()>; - // Platform integration callback for platforms that do not have full // run loop integration or don't want to block at the Mapbox GL Native // loop. It will be called from any thread and is up to the platform // to, after receiving the callback, call RunLoop::runOnce() from the // same thread as the Map object lives. - void setPlatformCallback(PlatformCallback&& callback) { platformCallback = std::move(callback); } + void setPlatformCallback(std::function<void()> callback) { platformCallback = std::move(callback); } // So far only needed by the libcurl backend. void addWatch(int fd, Event, std::function<void(int, Event)>&& callback); @@ -104,7 +102,10 @@ private: defaultQueue.emplace(std::move(task)); } wake(); - platformCallback(); + + if (platformCallback) { + platformCallback(); + } } void process() { @@ -127,7 +128,7 @@ private: } } - PlatformCallback platformCallback = [] {}; + std::function<void()> platformCallback; Queue defaultQueue; Queue highPriorityQueue; |