Lines Matching full:item
24 struct k_p4wq_work item; member
35 static void stress_handler(struct k_p4wq_work *item);
37 static void stress_sub(struct test_item *item) in stress_sub() argument
43 item->item.priority = sys_rand32_get() % (K_LOWEST_THREAD_PRIO - 1); in stress_sub()
44 item->item.deadline = sys_rand32_get() % k_ms_to_cyc_ceil32(2); in stress_sub()
45 item->item.handler = stress_handler; in stress_sub()
46 item->running = false; in stress_sub()
47 item->active = true; in stress_sub()
49 k_p4wq_submit(&wq, &item->item); in stress_sub()
52 static void stress_handler(struct k_p4wq_work *item) in stress_handler() argument
55 struct test_item *titem = CONTAINER_OF(item, struct test_item, item); in stress_handler()
61 zassert_true(curr_pri == item->priority, in stress_handler()
62 "item ran with wrong priority: want %d have %d", in stress_handler()
63 item->priority, curr_pri); in stress_handler()
72 /* Pick 0-3 random item slots and submit them if they aren't in stress_handler()
80 if (items[ii].item.thread == NULL && in stress_handler()
108 items[0].item.priority = -1; in ZTEST()
109 stress_handler(&items[0].item); in ZTEST()
137 static void spin_handler(struct k_p4wq_work *item) in spin_handler() argument
144 /* Selects and adds a new item to the queue, returns an indication of
145 * whether the item changed the number of active threads. Does not
146 * return the item itself, not needed.
152 struct k_p4wq_work *item = &items[num_items++].item; in add_new_item() local
155 item->priority = pri; in add_new_item()
156 item->deadline = k_us_to_cyc_ceil32(100); in add_new_item()
157 item->handler = spin_handler; in add_new_item()
158 k_p4wq_submit(&wq, item); in add_new_item()
174 /* The work item priorities are 0-4, this thread should be -1 in ZTEST()
219 static void resubmit_handler(struct k_p4wq_work *item) in resubmit_handler() argument
222 k_p4wq_submit(&wq, item); in resubmit_handler()
227 zassert_false(k_p4wq_cancel(&wq, item), in resubmit_handler()
228 "item should not be cancelable while running"); in resubmit_handler()
232 /* Validate item can be resubmitted from its own handler */
246 zassert_equal(work, &simple_item, "bad work item pointer"); in simple_handler()
258 /* Lower priority item, should not run until we yield */ in ZTEST()
268 zassert_true(has_run, "low-priority item didn't run"); in ZTEST()
274 zassert_true(has_run, "high-priority item didn't run"); in ZTEST()