| 341 | } |
| 342 | |
| 343 | static 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 | |
| 380 | static struct rt_workqueue *queue_3; |
| 381 |
nothing calls this directly
no test coverage detected