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

Function test_idle_hook

src/utest/thread_tc.c:206–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

204}
205
206static void test_idle_hook(void)
207{
208 rt_err_t ret_startup = -RT_ERROR;
209
210 rt_thread_idle_sethook(idle_hook);
211
212 tid4 = rt_thread_create("thread4",
213 thread4_entry,
214 RT_NULL,
215 THREAD_STACK_SIZE,
216 UTEST_THR_PRIORITY - 1,
217 THREAD_TIMESLICE);
218 if (tid4 == RT_NULL)
219 {
220 LOG_E("rt_thread_create failed!");
221 uassert_false(tid4 == RT_NULL);
222 goto __exit;
223 }
224
225 ret_startup = rt_thread_startup(tid4);
226 if (ret_startup != RT_EOK)
227 {
228 LOG_E("rt_thread_startup failed!");
229 uassert_false(1);
230 goto __exit;
231 }
232
233 while (tid4_finish_flag != 1)
234 {
235 rt_thread_mdelay(200);
236 }
237 uassert_true(entry_idle_hook_times > 0);
238
239__exit:
240 return;
241}
242
243static void thread5_entry(void *parameter)
244{

Callers

nothing calls this directly

Calls 4

rt_thread_idle_sethookFunction · 0.85
rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
rt_thread_mdelayFunction · 0.85

Tested by

no test coverage detected