From 92bf8547aa64dddad2ecd387a352f89bbc475c88 Mon Sep 17 00:00:00 2001 From: tkernelcn <90441159+tkernelcn@users.noreply.github.com> Date: Thu, 28 Dec 2023 22:57:19 +0800 Subject: [PATCH] freertos: Add os_cond_broadcast for pthread wrapper (#2937) --- .../platform/common/freertos/freertos_thread.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/shared/platform/common/freertos/freertos_thread.c b/core/shared/platform/common/freertos/freertos_thread.c index 9f68bc8f..0356c3ed 100644 --- a/core/shared/platform/common/freertos/freertos_thread.c +++ b/core/shared/platform/common/freertos/freertos_thread.c @@ -452,3 +452,20 @@ os_cond_signal(korp_cond *cond) return BHT_OK; } + +int +os_cond_broadcast(korp_cond *cond) +{ + /* Signal all of the wait node of wait list */ + xSemaphoreTake(cond->wait_list_lock, portMAX_DELAY); + if (cond->thread_wait_list) { + os_thread_wait_node *p = cond->thread_wait_list; + while (p) { + xSemaphoreGive(p->sem); + p = p->next; + } + } + xSemaphoreGive(cond->wait_list_lock); + + return BHT_OK; +}