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

Function cancle_work_test02

components/drivers/ipc/utest/workqueue_tc.c:160–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160static void cancle_work_test02(void)
161{
162 struct rt_workqueue *queue;
163 rt_uint8_t curr_priority;
164 struct rt_work work;
165 rt_err_t err;
166
167 /* 1 higher priority than the current test thread */
168 curr_priority = get_test_thread_priority(-1);
169 queue = rt_workqueue_create("test", 2048, curr_priority);
170 if (queue == RT_NULL)
171 {
172 LOG_E("queue create failed, L:%d", __LINE__);
173 return;
174 }
175 rt_work_init(&work, cancle_work_test02_fun, RT_NULL);
176 /* Cancel the work while it is in progress */
177 err = rt_workqueue_submit_work(queue, &work, 0);
178 uassert_int_equal(err, RT_EOK);
179
180 rt_thread_delay(5);
181 err = rt_workqueue_cancel_work(queue, &work);
182 uassert_int_equal(err, -RT_EBUSY);
183
184 rt_thread_delay(100);
185 rt_workqueue_destroy(queue);
186}
187
188static void cancle_work_test03_fun(struct rt_work *work, void *work_data)
189{

Callers

nothing calls this directly

Calls 7

get_test_thread_priorityFunction · 0.85
rt_workqueue_createFunction · 0.85
rt_work_initFunction · 0.85
rt_workqueue_submit_workFunction · 0.85
rt_thread_delayFunction · 0.85
rt_workqueue_cancel_workFunction · 0.85
rt_workqueue_destroyFunction · 0.85

Tested by

no test coverage detected