Skip to content

Commit

Permalink
Update libuv loop time after timer callback
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-cojocaru committed Nov 20, 2024
1 parent b8195b8 commit c765fad
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/mbgl/util/run_loop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions platform/default/src/mbgl/util/run_loop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions platform/glfw/glfw_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,8 @@ void GLFWView::run() {
}

render();

runLoop.updateTime();
};

// Cap frame rate to 60hz if benchmark mode is disabled
Expand Down

0 comments on commit c765fad

Please sign in to comment.