优化代码,修改 FALLTHROUGH 宏定义,增加递归互斥锁支持,改进调度器挂起和恢复逻辑,增强命令查找功能

This commit is contained in:
LokLiang
2025-05-20 09:00:06 +08:00
parent 66f799bd1c
commit 499994b239
6 changed files with 104 additions and 63 deletions

View File

@@ -6,7 +6,7 @@ os_state os_mutex_create(os_mutex_t *mutex)
{
OS_ASS_HDL(!os_mutex_is_valid(mutex), mutex->handle);
mutex->handle = xSemaphoreCreateMutex();
mutex->handle = xSemaphoreCreateRecursiveMutex();
if (mutex->handle == NULL)
{
OS_ERR("err %p\r\n", mutex->handle);
@@ -31,7 +31,7 @@ os_state os_mutex_lock(os_mutex_t *mutex, os_time_t wait_ms)
OS_ASS_HDL(os_mutex_is_valid(mutex), mutex->handle);
ret = xSemaphoreTake(mutex->handle, os_calc_msec_to_ticks(wait_ms));
ret = xSemaphoreTakeRecursive(mutex->handle, os_calc_msec_to_ticks(wait_ms));
if (ret != pdPASS)
{
OS_DBG("%s() fail @ %d, %u ms\n", __func__, __LINE__, wait_ms);
@@ -47,7 +47,7 @@ os_state os_mutex_unlock(os_mutex_t *mutex)
OS_ASS_HDL(os_mutex_is_valid(mutex), mutex->handle);
ret = xSemaphoreGive(mutex->handle);
ret = xSemaphoreGiveRecursive(mutex->handle);
if (ret != pdPASS)
{
OS_DBG("%s() fail @ %d\n", __func__, __LINE__);