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

Function wait_safely

components/drivers/ipc/utest/completion_timeout_tc.c:78–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78static void wait_safely(struct rt_completion *completion)
79{
80 int try_times = 3;
81 rt_err_t error;
82 do
83 {
84 /* wait for one tick, to add more random */
85 error = rt_completion_wait_flags(completion, 1, RT_INTERRUPTIBLE);
86 if (error)
87 {
88 if (error == -RT_ETIMEOUT || error == -RT_EINTR)
89 {
90 _async_intr_count++;
91 }
92 else
93 {
94 LOG_I("Async event %d\n", error);
95 uassert_true(0);
96 }
97 rt_thread_yield();
98 }
99 else
100 {
101 break;
102 }
103 } while (try_times--);
104
105 if (error != RT_EOK)
106 {
107 uassert_true(error == RT_EOK);
108 _test_thread_exit_failure("wait failed");
109 }
110}
111
112static void producer_thread_entry(void *parameter)
113{

Callers 2

producer_thread_entryFunction · 0.70
consumer_thread_entryFunction · 0.70

Calls 3

rt_thread_yieldFunction · 0.85
rt_completion_wait_flagsFunction · 0.50

Tested by

no test coverage detected