Lines Matching +full:key +full:- +full:list +full:- +full:int
2 * Copyright (c) 2010-2016 Wind River Systems, Inc.
4 * SPDX-License-Identifier: Apache-2.0
10 * @brief dynamic-size QUEUE object.
36 * did a behind-the scenes memory allocation of an alloc_node in z_queue_node_peek()
43 ret = anode->data; in z_queue_node_peek()
49 * reserved for the linked list. User mode isn't allowed to in z_queue_node_peek()
60 sys_sflist_init(&queue->data_q); in z_impl_k_queue_init()
61 queue->lock = (struct k_spinlock) {}; in z_impl_k_queue_init()
62 z_waitq_init(&queue->wait_q); in z_impl_k_queue_init()
64 sys_dlist_init(&queue->poll_events); in z_impl_k_queue_init()
90 z_handle_obj_poll_events(&queue->poll_events, state); in handle_poll_events()
101 k_spinlock_key_t key = k_spin_lock(&queue->lock); in z_impl_k_queue_cancel_wait() local
104 first_pending_thread = z_unpend_first_thread(&queue->wait_q); in z_impl_k_queue_cancel_wait()
111 z_reschedule(&queue->lock, key); in z_impl_k_queue_cancel_wait()
127 k_spinlock_key_t key = k_spin_lock(&queue->lock); in queue_insert() local
132 prev = sys_sflist_peek_tail(&queue->data_q); in queue_insert()
134 first_pending_thread = z_unpend_first_thread(&queue->wait_q); in queue_insert()
140 z_reschedule(&queue->lock, key); in queue_insert()
153 k_spin_unlock(&queue->lock, key); in queue_insert()
156 -ENOMEM); in queue_insert()
158 return -ENOMEM; in queue_insert()
160 anode->data = data; in queue_insert()
161 sys_sfnode_init(&anode->node, 0x1); in queue_insert()
169 sys_sflist_insert(&queue->data_q, prev, data); in queue_insert()
171 z_reschedule(&queue->lock, key); in queue_insert()
247 int k_queue_append_list(struct k_queue *queue, void *head, void *tail) in k_queue_append_list()
251 /* invalid head or tail of list */ in k_queue_append_list()
253 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_queue, append_list, queue, -EINVAL); in k_queue_append_list()
255 return -EINVAL; in k_queue_append_list()
258 k_spinlock_key_t key = k_spin_lock(&queue->lock); in k_queue_append_list() local
262 thread = z_unpend_first_thread(&queue->wait_q); in k_queue_append_list()
268 thread = z_unpend_first_thread(&queue->wait_q); in k_queue_append_list()
272 sys_sflist_append_list(&queue->data_q, head, tail); in k_queue_append_list()
278 z_reschedule(&queue->lock, key); in k_queue_append_list()
282 int k_queue_merge_slist(struct k_queue *queue, sys_slist_t *list) in k_queue_merge_slist() argument
284 int ret; in k_queue_merge_slist()
288 /* list must not be empty */ in k_queue_merge_slist()
289 CHECKIF(sys_slist_is_empty(list)) { in k_queue_merge_slist()
290 SYS_PORT_TRACING_OBJ_FUNC_EXIT(k_queue, merge_slist, queue, -EINVAL); in k_queue_merge_slist()
292 return -EINVAL; in k_queue_merge_slist()
297 * - the slist implementation keeps the next pointer as the first in k_queue_merge_slist()
299 * - list->tail->next = NULL. in k_queue_merge_slist()
300 * - sflist implementation only differs from slist by stuffing in k_queue_merge_slist()
302 * - source list is really an slist and not an sflist with flags set in k_queue_merge_slist()
304 ret = k_queue_append_list(queue, list->head, list->tail); in k_queue_merge_slist()
310 sys_slist_init(list); in k_queue_merge_slist()
319 k_spinlock_key_t key = k_spin_lock(&queue->lock); in z_impl_k_queue_get() local
324 if (likely(!sys_sflist_is_empty(&queue->data_q))) { in z_impl_k_queue_get()
327 node = sys_sflist_get_not_empty(&queue->data_q); in z_impl_k_queue_get()
329 k_spin_unlock(&queue->lock, key); in z_impl_k_queue_get()
339 k_spin_unlock(&queue->lock, key); in z_impl_k_queue_get()
346 int ret = z_pend_curr(&queue->lock, key, &queue->wait_q, timeout); in z_impl_k_queue_get()
349 (ret != 0) ? NULL : arch_current_thread()->base.swap_data); in z_impl_k_queue_get()
351 return (ret != 0) ? NULL : arch_current_thread()->base.swap_data; in z_impl_k_queue_get()
358 bool ret = sys_sflist_find_and_remove(&queue->data_q, (sys_sfnode_t *)data); in k_queue_remove()
371 SYS_SFLIST_FOR_EACH_NODE(&queue->data_q, test) { in k_queue_unique_append()
388 void *ret = z_queue_node_peek(sys_sflist_peek_head(&queue->data_q), false); in z_impl_k_queue_peek_head()
397 void *ret = z_queue_node_peek(sys_sflist_peek_tail(&queue->data_q), false); in z_impl_k_queue_peek_tail()
413 static inline int z_vrfy_k_queue_is_empty(struct k_queue *queue) in z_vrfy_k_queue_is_empty()
439 static int init_fifo_obj_core_list(void) in init_fifo_obj_core_list()
462 static int init_lifo_obj_core_list(void) in init_lifo_obj_core_list()