From d715767cef509a7b4de0d836ba13a771ed3d266e Mon Sep 17 00:00:00 2001 From: Aleksandr Kutuzov Date: Fri, 16 Oct 2020 15:16:54 +0300 Subject: [PATCH] GUI: osWaitForeverfor in queue put, simplify osMessageQueueGet. --- applications/gui/gui_event.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/applications/gui/gui_event.c b/applications/gui/gui_event.c index 8d0914c2..44b4d5fc 100644 --- a/applications/gui/gui_event.c +++ b/applications/gui/gui_event.c @@ -19,7 +19,7 @@ void gui_event_input_events_callback(const void* value, size_t size, void* ctx) message.type = GuiMessageTypeInput; message.input = *(InputEvent*)value; - osMessageQueuePut(gui_event->mqueue, &message, 0, 0); + osMessageQueuePut(gui_event->mqueue, &message, 0, osWaitForever); } GuiEvent* gui_event_alloc() { @@ -67,8 +67,7 @@ GuiMessage gui_event_message_next(GuiEvent* gui_event) { assert(gui_event); GuiMessage message; gui_event_unlock(gui_event); - while(osMessageQueueGet(gui_event->mqueue, &message, NULL, osWaitForever) != osOK) { - }; + assert(osMessageQueueGet(gui_event->mqueue, &message, NULL, osWaitForever) == osOK); gui_event_lock(gui_event); return message; }