38 queue->max_size = max_size;
129 if (rz_list_empty(
queue->list)) {
152 bool is_empty = rz_list_empty(
queue->list);
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API RZ_BORROW RzListIter * rz_list_prepend(RZ_NONNULL RzList *list, void *data)
Appends at the beginning of the list a new element.
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_OWN void * rz_list_pop(RZ_NONNULL RzList *list)
Removes and returns the last element of the list.
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API RZ_OWN void * rz_list_pop_head(RZ_NONNULL RzList *list)
Removes and returns the first element of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
#define rz_return_val_if_fail(expr, val)
void(* RzListFree)(void *ptr)
#define RZ_THREAD_QUEUE_UNLIMITED
RzThreadQueue is a thread-safe queue that can be listened on from multiple threads.
RZ_API void rz_th_cond_free(RZ_NULLABLE RzThreadCond *cond)
Frees a RzThreadCond struct.
RZ_API void rz_th_cond_signal(RZ_NONNULL RzThreadCond *cond)
This function shall unblock at least one of the threads that are blocked on the specified condition.
RZ_API void rz_th_cond_wait(RZ_NONNULL RzThreadCond *cond, RZ_NONNULL RzThreadLock *lock)
The function shall block on a condition variable and shall be called with RzThreadLock locked by the ...
RZ_API RZ_OWN RzThreadCond * rz_th_cond_new(void)
Condition variables are intended to be used to communicate changes in the state of data shared betwee...
RZ_API void rz_th_lock_leave(RZ_NONNULL RzThreadLock *thl)
Releases a RzThreadLock structure.
RZ_API void rz_th_lock_free(RZ_NULLABLE RzThreadLock *thl)
Frees a RzThreadLock structure.
RZ_API RZ_OWN RzThreadLock * rz_th_lock_new(bool recursive)
Allocates and initialize a RzThreadLock structure.
RZ_API void rz_th_lock_enter(RZ_NONNULL RzThreadLock *thl)
Acquires a RzThreadLock structure.
RZ_API bool rz_th_queue_is_full(RZ_NONNULL RzThreadQueue *queue)
Returns true if the queue is full and when the size is not RZ_THREAD_QUEUE_UNLIMITED (thread-safe)
RZ_API bool rz_th_queue_is_empty(RZ_NONNULL RzThreadQueue *queue)
Returns true if the queue is empty (thread-safe)
RZ_API bool rz_th_queue_push(RZ_NONNULL RzThreadQueue *queue, RZ_NONNULL void *user, bool tail)
Pushes a new element into the queue.
RZ_API void rz_th_queue_free(RZ_NULLABLE RzThreadQueue *queue)
Frees a RzThreadQueue structure.
RZ_API RZ_OWN void * rz_th_queue_wait_pop(RZ_NONNULL RzThreadQueue *queue, bool tail)
Removes an element from the queue, but yields the thread till not empty.
RZ_API RZ_OWN void * rz_th_queue_pop(RZ_NONNULL RzThreadQueue *queue, bool tail)
Removes an element from the queue, but does not awaits when empty.
RZ_API RZ_OWN RzThreadQueue * rz_th_queue_new(size_t max_size, RZ_NULLABLE RzListFree qfree)
Allocates and initializes a new fifo queue.