MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / _waitq_inqueue

Function _waitq_inqueue

components/drivers/ipc/condvar.c:37–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37static int _waitq_inqueue(rt_wqueue_t *queue, struct rt_wqueue_node *node,
38 rt_tick_t timeout, int suspend_flag)
39{
40 rt_thread_t tcb = node->polling_thread;
41 rt_timer_t timer = &(tcb->thread_timer);
42 rt_err_t ret;
43
44 if (queue->flag != RT_WQ_FLAG_WAKEUP)
45 {
46 ret = rt_thread_suspend_with_flag(tcb, suspend_flag);
47 if (ret == RT_EOK)
48 {
49 rt_wqueue_add(queue, node);
50 if (timeout != (rt_tick_t)RT_WAITING_FOREVER)
51 {
52 rt_timer_control(timer, RT_TIMER_CTRL_SET_TIME, &timeout);
53
54 rt_timer_start(timer);
55 }
56 }
57 }
58 else
59 {
60 ret = RT_EOK;
61 }
62
63 return ret;
64}
65
66#define INIT_WAITQ_NODE(node) \
67 { \

Callers 1

rt_condvar_timedwaitFunction · 0.85

Calls 4

rt_wqueue_addFunction · 0.85
rt_timer_controlFunction · 0.85
rt_timer_startFunction · 0.85

Tested by

no test coverage detected