From 501d9b4a4433015974ddb35a448ab2898bb9b733 Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 6 Feb 2025 10:56:10 +0100 Subject: [PATCH] ios: fix timers Fixes #4074. Fixes #3816. --- src/changelog/unreleased.md | 1 + src/platform_impl/ios/app_state.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/changelog/unreleased.md b/src/changelog/unreleased.md index afe1edb60..460d62f69 100644 --- a/src/changelog/unreleased.md +++ b/src/changelog/unreleased.md @@ -48,3 +48,4 @@ changelog entry. - On X11, fix crash with uim. - On X11, fix modifiers for keys that were sent by the same X11 request. +- On iOS, fix high CPU usage even when using `ControlFlow::Wait`. diff --git a/src/platform_impl/ios/app_state.rs b/src/platform_impl/ios/app_state.rs index 30019a070..e34bf43c9 100644 --- a/src/platform_impl/ios/app_state.rs +++ b/src/platform_impl/ios/app_state.rs @@ -375,6 +375,7 @@ impl AppState { (ControlFlow::Wait, ControlFlow::Wait) => { let start = Instant::now(); self.set_state(AppStateImpl::Waiting { waiting_handler, start }); + self.waker.stop() }, (ControlFlow::WaitUntil(old_instant), ControlFlow::WaitUntil(new_instant)) if old_instant == new_instant =>