From 06ee165ab6b656a1d41bf3eb16d1b350beeaad89 Mon Sep 17 00:00:00 2001 From: Vadim Kaushan Date: Thu, 17 Sep 2020 12:58:45 +0300 Subject: [PATCH] Lock furi record for the whole notification process (#119) Co-authored-by: aanper --- core/furi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/furi.c b/core/furi.c index f3a7507aca0..0f205c48253 100644 --- a/core/furi.c +++ b/core/furi.c @@ -209,8 +209,8 @@ void furi_give(FuriRecordSubscriber* handler) { void furi_commit(FuriRecordSubscriber* handler) { if(handler == NULL || handler->record == NULL) return; - furi_give(handler); furi_notify(handler, handler->record->value, handler->record->size); + furi_give(handler); } bool furi_read(FuriRecordSubscriber* handler, void* value, size_t size) { @@ -227,8 +227,8 @@ bool furi_read(FuriRecordSubscriber* handler, void* value, size_t size) { furi_take(handler); memcpy(value, handler->record->value, size); - furi_give(handler); furi_notify(handler, value, size); + furi_give(handler); return true; } @@ -272,17 +272,17 @@ bool furi_write(FuriRecordSubscriber* handler, const void* value, size_t size) { return false; } + furi_take(handler); if(handler->record->value != NULL) { // real write to value - furi_take(handler); memcpy(handler->record->value, value, size); - furi_give(handler); // notify subscribers furi_notify(handler, handler->record->value, handler->record->size); } else { furi_notify(handler, value, size); } + furi_give(handler); return true; } \ No newline at end of file