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

Function repeat_work_test02

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

Source from the content-addressed store, hash-verified

341}
342
343static void repeat_work_test02(void)
344{
345 struct rt_workqueue *queue;
346 rt_uint8_t curr_priority;
347 struct rt_work work;
348 volatile int work_flag = 0;
349 rt_err_t err;
350
351 /* 1 priority higher than current test thread */
352 curr_priority = get_test_thread_priority(-1);
353 queue = rt_workqueue_create("test02", 2048, curr_priority);
354 if (queue == RT_NULL)
355 {
356 LOG_E("queue create failed, L:%d", __LINE__);
357 return;
358 }
359 rt_work_init(&work, repeat_work_test02_fun, (void *)&work_flag);
360 /* Submit work with high queue priority that will be executed immediately */
361 err = rt_workqueue_submit_work(queue, &work, 0);
362 uassert_int_equal(err, RT_EOK);
363
364 rt_thread_delay(5);
365 /* Re-submission of work in progress */
366 err = rt_workqueue_submit_work(queue, &work, 0);
367 if (err != RT_EOK)
368 {
369 LOG_E("L:%d err. %d", __LINE__, err);
370 }
371 rt_thread_delay(10);
372 uassert_int_equal(work_flag, 1);
373
374 rt_thread_delay(10);
375 uassert_int_equal(work_flag, 2);
376
377 rt_workqueue_destroy(queue);
378}
379
380static struct rt_workqueue *queue_3;
381

Callers

nothing calls this directly

Calls 6

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_destroyFunction · 0.85

Tested by

no test coverage detected