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

Function test_thread_yield_entry

src/utest/thread_tc.c:586–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

584}
585
586static void test_thread_yield_entry(void *parameter)
587{
588 rt_err_t ret_startup = -RT_ERROR;
589
590 rt_thread_t tid;
591 rt_uint32_t loop = 0;
592 rt_uint32_t count_before;
593
594 tid = rt_thread_create("inc", test_thread_yield_inc_entry, RT_NULL,
595 2048, 1, 10);
596 if (!tid)
597 {
598 LOG_E("rt_thread_create failed!");
599 return;
600 }
601
602 ret_startup = rt_thread_startup(tid);
603 if (ret_startup != RT_EOK)
604 {
605 LOG_E("rt_thread_startup failed!");
606 uassert_false(1);
607 return ;
608 }
609
610 while (1)
611 {
612 if (loop++ > 10000)
613 break;
614
615 count_before = yield_count;
616 rt_thread_yield();
617 if (yield_count == count_before)
618 {
619 LOG_E("yield error!");
620 return;
621 }
622 }
623 thread_yield_flag = 1;
624}
625
626void test_thread_yield_nosmp(void)
627{

Callers

nothing calls this directly

Calls 3

rt_thread_createFunction · 0.85
rt_thread_startupFunction · 0.85
rt_thread_yieldFunction · 0.85

Tested by

no test coverage detected