From 84fbe98d0d12ce3505cde24ca31ee5e39c1756c3 Mon Sep 17 00:00:00 2001 From: jugeeya Date: Tue, 17 Jan 2023 16:02:19 -0800 Subject: [PATCH] Quick Menu: fix speed, potential to deadlock --- src/common/menu.rs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/common/menu.rs b/src/common/menu.rs index d3c7f33..199fc64 100644 --- a/src/common/menu.rs +++ b/src/common/menu.rs @@ -282,24 +282,17 @@ pub unsafe fn quick_menu_loop() { std::thread::sleep(std::time::Duration::from_secs(10)); let backend = training_mod_tui::TestBackend::new(75, 15); let mut terminal = training_mod_tui::Terminal::new(backend).unwrap(); - let mut has_slept_millis = 0; - let render_frames = 5; let mut json_response = String::new(); let button_presses = &mut BUTTON_PRESSES; let mut received_input = true; loop { std::thread::sleep(std::time::Duration::from_millis(16)); - has_slept_millis += 16; - if has_slept_millis < 16 * render_frames { - continue; - } - has_slept_millis = 0; if !QUICK_MENU_ACTIVE { continue; } - let mut app = QUICK_MENU_APP.lock(); + let mut app = &mut *QUICK_MENU_APP.data_ptr(); button_presses.a.read_press().then(|| { app.on_a(); received_input = true;