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

Function do_work_test

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

Source from the content-addressed store, hash-verified

48}
49
50static void do_work_test(void)
51{
52 struct rt_workqueue *queue;
53 rt_uint8_t curr_priority;
54 struct rt_work work;
55 volatile int work_flag = 0;
56 rt_err_t err;
57
58 /* 1 higher priority than the current test thread */
59 curr_priority = get_test_thread_priority(-1);
60 queue = rt_workqueue_create("test", 2048, curr_priority);
61 if (queue == RT_NULL)
62 {
63 LOG_E("queue create failed, L:%d", __LINE__);
64 return;
65 }
66 rt_work_init(&work, do_work_test_fun, (void *)&work_flag);
67 err = rt_workqueue_submit_work(queue, &work, 0);
68 uassert_int_equal(err, RT_EOK);
69
70 /* Delay 5 ticks to ensure that the task has been executed */
71 rt_thread_delay(5);
72 uassert_int_equal(work_flag, 1);
73
74 rt_thread_delay(100);
75 rt_workqueue_destroy(queue);
76}
77
78static void do_delay_work_test_fun(struct rt_work *work, void *work_data)
79{

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