diff --git a/include/mbgl/util/run_loop.hpp b/include/mbgl/util/run_loop.hpp index b3d0108f010..755f4aeb7fd 100644 --- a/include/mbgl/util/run_loop.hpp +++ b/include/mbgl/util/run_loop.hpp @@ -47,6 +47,8 @@ class RunLoop : public Scheduler, private util::noncopyable { void runOnce(); void stop(); + void updateTime(); + /// 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 diff --git a/platform/default/src/mbgl/util/run_loop.cpp b/platform/default/src/mbgl/util/run_loop.cpp index 54705e481e4..0076299c655 100644 --- a/platform/default/src/mbgl/util/run_loop.cpp +++ b/platform/default/src/mbgl/util/run_loop.cpp @@ -149,6 +149,12 @@ void RunLoop::stop() { invoke([&] { uv_unref(impl->holderHandle()); }); } +void RunLoop::updateTime() { + MBGL_VERIFY_THREAD(tid); + + uv_update_time(impl->loop); +} + void RunLoop::waitForEmpty([[maybe_unused]] const mbgl::util::SimpleIdentity tag) { while (true) { std::size_t remaining; diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp index febb52d3ffe..96d3a149d9d 100644 --- a/platform/glfw/glfw_view.cpp +++ b/platform/glfw/glfw_view.cpp @@ -1100,6 +1100,8 @@ void GLFWView::run() { } render(); + + runLoop.updateTime(); }; // Cap frame rate to 60hz if benchmark mode is disabled