Skip to content

Commit 78bf542

Browse files
committed
Allow standard C library mutex allocation only when the kernel is running
1 parent 199dd72 commit 78bf542

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

CMSIS/RTOS2/FreeRTOS/Source/ARM/clib_arm.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,10 @@ static TaskHandle_t os_libspace_id[OS_THREAD_LIBSPACE_NUM];
8080

8181
/* OS Kernel state checking */
8282
static uint32_t os_kernel_is_active (void) {
83-
static uint8_t os_kernel_active = 0U;
84-
85-
if (os_kernel_active == 0U) {
86-
if (xTaskGetSchedulerState() != taskSCHEDULER_NOT_STARTED) {
87-
os_kernel_active = 1U;
88-
return 1U;
89-
}
90-
return 0U;
91-
} else {
83+
if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING) {
9284
return 1U;
85+
} else {
86+
return 0U;
9387
}
9488
}
9589

0 commit comments

Comments
 (0)