thread safety in newlib, newer lwip, optimized ISR for UART, some more stuff

This commit is contained in:
2023-10-06 17:29:07 +02:00
parent 1ba3d9412d
commit 1eb406074c
14 changed files with 75 additions and 157 deletions

19
mission/malloc_lock.c Normal file
View File

@ -0,0 +1,19 @@
#include "FreeRTOS.h"
#include "semphr.h"
SemaphoreHandle_t malloc_mutex = NULL;
void __malloc_lock(struct _reent *r) {
// if the mutex is not initialized yet, no task have been started either
if (malloc_mutex != NULL) {
xSemaphoreTakeRecursive(malloc_mutex, portMAX_DELAY);
}
}
void __malloc_unlock(struct _reent *r) {
// if the mutex is not initialized yet, no task have been started either
if (malloc_mutex != NULL) {
xSemaphoreGiveRecursive(malloc_mutex);
}
}