semaphore cleanup (#6)
This commit is contained in:
committed by
GitHub
parent
73ed5a5ebe
commit
b0ffa04d78
@@ -25,7 +25,7 @@ Gui* gui_alloc() {
|
||||
NULL
|
||||
);
|
||||
|
||||
instance->mutex = xSemaphoreCreateRecursiveMutex();
|
||||
instance->mutex = furi_mutex_alloc(FuriMutexTypeRecursive);
|
||||
|
||||
furi_check(lvgl_port_lock(100));
|
||||
instance->lvgl_parent = lv_scr_act();
|
||||
@@ -56,13 +56,13 @@ void gui_free(Gui* instance) {
|
||||
void gui_lock() {
|
||||
furi_assert(gui);
|
||||
furi_assert(gui->mutex);
|
||||
furi_check(xSemaphoreTakeRecursive(gui->mutex, portMAX_DELAY) == pdPASS);
|
||||
furi_check(furi_mutex_acquire(gui->mutex, 1000 / portTICK_PERIOD_MS) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void gui_unlock() {
|
||||
furi_assert(gui);
|
||||
furi_assert(gui->mutex);
|
||||
furi_check(xSemaphoreGiveRecursive(gui->mutex) == pdPASS);
|
||||
furi_check(furi_mutex_release(gui->mutex) == FuriStatusOk);
|
||||
}
|
||||
|
||||
void gui_request_draw() {
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "gui.h"
|
||||
#include "message_queue.h"
|
||||
#include "mutex.h"
|
||||
@@ -19,7 +17,7 @@
|
||||
struct Gui {
|
||||
// Thread and lock
|
||||
FuriThread* thread;
|
||||
SemaphoreHandle_t mutex;
|
||||
FuriMutex* mutex;
|
||||
|
||||
// Layers and Canvas
|
||||
ViewPort* layers[GuiLayerMAX];
|
||||
|
||||
Reference in New Issue
Block a user