From 86dcd781757e851052c07dcd4032b774d3f1741c Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Fri, 5 Apr 2024 20:26:42 +0100 Subject: [PATCH] Oops (semaphore vs apilock) This reverts commit f89f775d787f51fb147175b2b9156f94e07316d2. --- applications/services/desktop/desktop.c | 7 +++---- applications/services/desktop/desktop_i.h | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/applications/services/desktop/desktop.c b/applications/services/desktop/desktop.c index a042dc56b..38914f43a 100644 --- a/applications/services/desktop/desktop.c +++ b/applications/services/desktop/desktop.c @@ -34,10 +34,8 @@ static void desktop_loader_callback(const void* message, void* context) { const LoaderEvent* event = message; if(event->type == LoaderEventTypeApplicationBeforeLoad) { - desktop->animation_lock = api_lock_alloc_locked(); view_dispatcher_send_custom_event(desktop->view_dispatcher, DesktopGlobalBeforeAppStarted); - api_lock_wait_unlock_and_free(desktop->animation_lock); - desktop->animation_lock = NULL; + furi_check(furi_semaphore_acquire(desktop->animation_semaphore, 3000) == FuriStatusOk); } else if( event->type == LoaderEventTypeApplicationLoadFailed || event->type == LoaderEventTypeApplicationStopped) { @@ -125,7 +123,7 @@ static bool desktop_custom_event_callback(void* context, uint32_t event) { animation_manager_unload_and_stall_animation(desktop->animation_manager); } desktop_auto_lock_inhibit(desktop); - api_lock_unlock(desktop->animation_lock); + furi_semaphore_release(desktop->animation_semaphore); return true; case DesktopGlobalAfterAppFinished: animation_manager_load_and_continue_animation(desktop->animation_manager); @@ -282,6 +280,7 @@ void desktop_set_stealth_mode_state(Desktop* desktop, bool enabled) { Desktop* desktop_alloc(void) { Desktop* desktop = malloc(sizeof(Desktop)); + desktop->animation_semaphore = furi_semaphore_alloc(1, 0); desktop->animation_manager = animation_manager_alloc(); desktop->gui = furi_record_open(RECORD_GUI); desktop->scene_thread = furi_thread_alloc(); diff --git a/applications/services/desktop/desktop_i.h b/applications/services/desktop/desktop_i.h index c06ba40a2..1c1598c79 100644 --- a/applications/services/desktop/desktop_i.h +++ b/applications/services/desktop/desktop_i.h @@ -20,7 +20,6 @@ #include #include -#include #define STATUS_BAR_Y_SHIFT 13 @@ -81,7 +80,7 @@ struct Desktop { bool in_transition : 1; - FuriApiLock animation_lock; + FuriSemaphore* animation_semaphore; Keybinds keybinds;