From 3dacea36cd75fc8dca6f831b3be56eef14c855bd Mon Sep 17 00:00:00 2001 From: sp-cai <70000077+sp-cai@users.noreply.github.com> Date: Fri, 12 Apr 2024 11:22:24 +0800 Subject: [PATCH] =?UTF-8?q?[ipc][condvar]=20=E4=BF=AE=E6=AD=A3=20'timeout'?= =?UTF-8?q?=20=E7=AC=A6=E5=8F=B7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit rt_tick_t 是无符号数据类型,而 'timeout' 有时用到负值或与负值比较,所以应该将 ‘ rt_tick_t timeout’ 改为 ‘rt_int32_t timeout’。 --- components/drivers/include/ipc/condvar.h | 2 +- components/drivers/ipc/condvar.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/drivers/include/ipc/condvar.h b/components/drivers/include/ipc/condvar.h index 1211df420d1..dc5cd5cf084 100644 --- a/components/drivers/include/ipc/condvar.h +++ b/components/drivers/include/ipc/condvar.h @@ -25,7 +25,7 @@ typedef struct rt_condvar void rt_condvar_init(rt_condvar_t cv, char *name); int rt_condvar_timedwait(rt_condvar_t cv, rt_mutex_t mtx, int suspend_flag, - rt_tick_t timeout); + rt_int32_t timeout); int rt_condvar_signal(rt_condvar_t cv); int rt_condvar_broadcast(rt_condvar_t cv); diff --git a/components/drivers/ipc/condvar.c b/components/drivers/ipc/condvar.c index 1eb42dc9add..e176ac502a5 100644 --- a/components/drivers/ipc/condvar.c +++ b/components/drivers/ipc/condvar.c @@ -35,7 +35,7 @@ void rt_condvar_init(rt_condvar_t cv, char *name) } static int _waitq_inqueue(rt_wqueue_t *queue, struct rt_wqueue_node *node, - rt_tick_t timeout, int suspend_flag) + rt_int32_t timeout, int suspend_flag) { rt_thread_t tcb = node->polling_thread; rt_timer_t timer = &(tcb->thread_timer); @@ -71,7 +71,7 @@ static int _waitq_inqueue(rt_wqueue_t *queue, struct rt_wqueue_node *node, } int rt_condvar_timedwait(rt_condvar_t cv, rt_mutex_t mtx, int suspend_flag, - rt_tick_t timeout) + rt_int32_t timeout) { rt_err_t acq_mtx_succ, rc; rt_atomic_t waiting_mtx;