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

Function test_static_thread

src/utest/thread_tc.c:98–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98static void test_static_thread(void)
99{
100 rt_err_t ret_init = -RT_ERROR;
101 rt_err_t ret_startup = -RT_ERROR;
102 rt_err_t ret_detach = -RT_ERROR;
103
104 ret_init = rt_thread_init(&thread2,
105 "thread2",
106 thread2_entry,
107 (void *)2,
108 &thread2_stack[0],
109 sizeof(thread2_stack),
110 UTEST_THR_PRIORITY + 1,
111 THREAD_TIMESLICE);
112 if (ret_init != RT_EOK)
113 {
114 uassert_false(ret_init != RT_EOK);
115 goto __exit;
116 }
117
118 ret_startup = rt_thread_startup(&thread2);
119 if (ret_startup != RT_EOK)
120 {
121 uassert_false(ret_startup != RT_EOK);
122 goto __exit;
123 }
124
125 ret_detach = rt_thread_detach(&thread2);
126 if (ret_detach != RT_EOK)
127 {
128 uassert_false(ret_detach != RT_EOK);
129 goto __exit;
130 }
131
132 uassert_true(ret_init == RT_EOK && ret_startup == RT_EOK && ret_detach == RT_EOK);
133
134__exit:
135 if (ret_init == RT_EOK && ret_detach != RT_EOK)
136 {
137 rt_thread_detach(&thread2);
138 }
139 return;
140}
141
142static void thread3_entry(void *parameter)
143{

Callers

nothing calls this directly

Calls 3

rt_thread_initFunction · 0.85
rt_thread_startupFunction · 0.85
rt_thread_detachFunction · 0.85

Tested by

no test coverage detected