Implement mutex for local target, fix concurrency test (#104)

* Implement mutex support for target_lo

* Kill application if test hangs

* Use mutex in furi_take and furi_give

* Give furi application enough time to finish

* remove app obj after build

* enable counting semaphores

Co-authored-by: aanper <mail@s3f.ru>
This commit is contained in:
Vadim Kaushan
2020-09-07 17:35:18 +03:00
committed by GitHub
parent 0307b12fd5
commit 884fccc591
8 changed files with 58 additions and 18 deletions

View File

@@ -192,15 +192,18 @@ static void furi_notify(FuriRecordSubscriber* handler, const void* value, size_t
void* furi_take(FuriRecordSubscriber* handler) {
if(handler == NULL || handler->record == NULL) return NULL;
// take mutex
return handler->record->value;
if (xSemaphoreTake(handler->record->mutex, portMAX_DELAY) == pdTRUE) {
return handler->record->value;
} else {
return NULL;
}
}
void furi_give(FuriRecordSubscriber* handler) {
if(handler == NULL || handler->record == NULL) return;
// release mutex
xSemaphoreGive(handler->record->mutex);
}
void furi_commit(FuriRecordSubscriber* handler) {