Lines Matching full:queue

79 	struct k_p4wq *queue = p0;  in p4wq_loop()  local
80 k_spinlock_key_t k = k_spin_lock(&queue->lock); in p4wq_loop()
83 struct rbnode *r = rb_get_max(&queue->queue); in p4wq_loop()
89 rb_remove(&queue->queue, r); in p4wq_loop()
91 sys_dlist_append(&queue->active, &w->dlnode); in p4wq_loop()
95 k_spin_unlock(&queue->lock, k); in p4wq_loop()
99 k = k_spin_lock(&queue->lock); in p4wq_loop()
110 z_pend_curr(&queue->lock, k, &queue->waitq, K_FOREVER); in p4wq_loop()
111 k = k_spin_lock(&queue->lock); in p4wq_loop()
126 void k_p4wq_init(struct k_p4wq *queue) in k_p4wq_init() argument
128 memset(queue, 0, sizeof(*queue)); in k_p4wq_init()
129 z_waitq_init(&queue->waitq); in k_p4wq_init()
130 queue->queue.lessthan_fn = rb_lessthan; in k_p4wq_init()
131 sys_dlist_init(&queue->active); in k_p4wq_init()
134 void k_p4wq_add_thread(struct k_p4wq *queue, struct k_thread *thread, in k_p4wq_add_thread() argument
139 p4wq_loop, queue, NULL, NULL, in k_p4wq_add_thread()
141 queue->flags & K_P4WQ_DELAYED_START ? K_FOREVER : K_NO_WAIT); in k_p4wq_add_thread()
151 pp->queue + i : pp->queue; in static_init()
186 void k_p4wq_enable_static_thread(struct k_p4wq *queue, struct k_thread *thread, in k_p4wq_enable_static_thread() argument
190 if (queue->flags & K_P4WQ_USER_CPU_MASK) { in k_p4wq_enable_static_thread()
204 if (queue->flags & K_P4WQ_DELAYED_START) { in k_p4wq_enable_static_thread()
215 void k_p4wq_submit(struct k_p4wq *queue, struct k_p4wq_work *item) in k_p4wq_submit() argument
217 k_spinlock_key_t k = k_spin_lock(&queue->lock); in k_p4wq_submit()
235 rb_insert(&queue->queue, &item->rbnode); in k_p4wq_submit()
236 item->queue = queue; in k_p4wq_submit()
238 /* If there were other items already ahead of it in the queue, in k_p4wq_submit()
242 if (rb_get_max(&queue->queue) != &item->rbnode) { in k_p4wq_submit()
254 SYS_DLIST_FOR_EACH_CONTAINER(&queue->active, wi, dlnode) { in k_p4wq_submit()
270 /* Grab a thread, set its priority and queue it. If there are in k_p4wq_submit()
275 struct k_thread *th = z_unpend_first_thread(&queue->waitq); in k_p4wq_submit()
284 z_reschedule(&queue->lock, k); in k_p4wq_submit()
289 k_spin_unlock(&queue->lock, k); in k_p4wq_submit()
292 bool k_p4wq_cancel(struct k_p4wq *queue, struct k_p4wq_work *item) in k_p4wq_cancel() argument
294 k_spinlock_key_t k = k_spin_lock(&queue->lock); in k_p4wq_cancel()
295 bool ret = rb_contains(&queue->queue, &item->rbnode); in k_p4wq_cancel()
298 rb_remove(&queue->queue, &item->rbnode); in k_p4wq_cancel()
302 k_spin_unlock(&queue->lock, k); in k_p4wq_cancel()