freertos: Add os_cond_broadcast for pthread wrapper (#2937)

This commit is contained in:
tkernelcn 2023-12-28 22:57:19 +08:00 committed by GitHub
parent 22c5c90340
commit 92bf8547aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;
}