Lines Matching refs:queue

31 typedef void (*fixed_queue_cb)(fixed_queue_t* queue, void* context);
33 // Creates a new fixed queue with the given |capacity|. If more elements than
34 // |capacity| are added to the queue, the caller is blocked until space is
35 // made available in the queue. Returns NULL on failure. The caller must free
36 // the returned queue with |fixed_queue_free|.
39 // Frees a queue and (optionally) the enqueued elements.
40 // |queue| is the queue to free. If the |free_cb| callback is not null,
41 // it is called on each queue element to free it.
42 // Freeing a queue that is currently in use (i.e. has waiters
44 void fixed_queue_free(fixed_queue_t* queue, fixed_queue_free_cb free_cb);
46 // Flushes a queue and (optionally) frees the enqueued elements.
47 // |queue| is the queue to flush. If the |free_cb| callback is not null,
48 // it is called on each queue element to free it.
49 void fixed_queue_flush(fixed_queue_t* queue, fixed_queue_free_cb free_cb);
51 // Returns a value indicating whether the given |queue| is empty. If |queue|
53 bool fixed_queue_is_empty(fixed_queue_t* queue);
55 // Returns the length of the |queue|. If |queue| is NULL, the return value
57 size_t fixed_queue_length(fixed_queue_t* queue);
59 // Returns the maximum number of elements this queue may hold. |queue| may
61 size_t fixed_queue_capacity(fixed_queue_t* queue);
63 // Enqueues the given |data| into the |queue|. The caller will be blocked
64 // if no more space is available in the queue. Neither |queue| nor |data|
66 void fixed_queue_enqueue(fixed_queue_t* queue, void* data);
68 // Dequeues the next element from |queue|. If the queue is currently empty,
70 // function will never return NULL. |queue| may not be NULL.
71 void* fixed_queue_dequeue(fixed_queue_t* queue);
73 // Tries to enqueue |data| into the |queue|. This function will never block
74 // the caller. If the queue capacity would be exceeded by adding one more
76 // returns true. Neither |queue| nor |data| may be NULL.
77 bool fixed_queue_try_enqueue(fixed_queue_t* queue, void* data);
79 // Tries to dequeue an element from |queue|. This function will never block
80 // the caller. If the queue is empty or NULL, this function returns NULL
81 // immediately. Otherwise, the next element in the queue is returned.
82 void* fixed_queue_try_dequeue(fixed_queue_t* queue);
84 // Returns the first element from |queue|, if present, without dequeuing it.
86 // elements in the queue or |queue| is NULL.
87 void* fixed_queue_try_peek_first(fixed_queue_t* queue);
89 // Returns the last element from |queue|, if present, without dequeuing it.
91 // elements in the queue or |queue| is NULL.
92 void* fixed_queue_try_peek_last(fixed_queue_t* queue);
94 // Tries to remove a |data| element from the middle of the |queue|. This
95 // function will never block the caller. If the queue is empty or NULL, this
97 // element is found in the queue, a pointer to the removed data is returned,
99 void* fixed_queue_try_remove_from_queue(fixed_queue_t* queue, void* data);
101 // Returns the iterateable list with all entries in the |queue|. This function
102 // will never block the caller. |queue| may not be NULL.
108 list_t* fixed_queue_get_list(fixed_queue_t* queue);
113 // blocking. The caller must not close the returned file descriptor. |queue|
115 int fixed_queue_get_enqueue_fd(const fixed_queue_t* queue);
120 // blocking. The caller must not close the returned file descriptor. |queue|
122 int fixed_queue_get_dequeue_fd(const fixed_queue_t* queue);
124 // Registers |queue| with |reactor| for dequeue operations. When there is an
125 // element in the queue, ready_cb will be called. The |context| parameter is
126 // passed, untouched, to the callback routine. Neither |queue|, nor |reactor|,
128 void fixed_queue_register_dequeue(fixed_queue_t* queue, reactor_t* reactor,
131 // Unregisters the dequeue ready callback for |queue| from whichever reactor
133 void fixed_queue_unregister_dequeue(fixed_queue_t* queue);