From ad8cdf727bca357841b30c78bf035303c12dd648 Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 13 Mar 2023 13:37:03 +0100 Subject: [PATCH] ngui: yield CPU during standby mode when the screen turns off, the idle loop never gave a chance CPU to do other work and pegged at 100%. adding a short sleep each cycle yields CPU to the OS. closes https://git.qcode.ch/nakamochi/ndg/issues/15 --- src/ui/screen.zig | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/screen.zig b/src/ui/screen.zig index 7004ade..16894d0 100644 --- a/src/ui/screen.zig +++ b/src/ui/screen.zig @@ -30,6 +30,7 @@ pub fn sleep(wake: *const Thread.ResetEvent) void { return; } std.atomic.spinLoopHint(); + std.time.sleep(10 * std.time.ns_per_ms); } }