[ipc][condvar] 修正 'timeout' 符号问题

rt_tick_t 是无符号数据类型,而 'timeout' 有时用到负值或与负值比较,所以应该将 ‘ rt_tick_t timeout’  改为 ‘rt_int32_t timeout’。
This commit is contained in:
sp-cai 2024-04-12 11:22:24 +08:00
parent 6dbdf9c360
commit 3dacea36cd
2 changed files with 3 additions and 3 deletions

View File

@ -25,7 +25,7 @@ typedef struct rt_condvar
void rt_condvar_init(rt_condvar_t cv, char *name); 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, 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_signal(rt_condvar_t cv);
int rt_condvar_broadcast(rt_condvar_t cv); int rt_condvar_broadcast(rt_condvar_t cv);

View File

@ -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, 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_thread_t tcb = node->polling_thread;
rt_timer_t timer = &(tcb->thread_timer); 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, 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_err_t acq_mtx_succ, rc;
rt_atomic_t waiting_mtx; rt_atomic_t waiting_mtx;