Rizin
unix-like reverse engineering framework and cli tools
|
Go to the source code of this file.
Classes | |
struct | rz_th_queue_t |
RzThreadQueue is a thread-safe queue that can be listened on from multiple threads. More... | |
Functions | |
RZ_API RZ_OWN RzThreadQueue * | rz_th_queue_new (size_t max_size, RZ_NULLABLE RzListFree qfree) |
Allocates and initializes a new fifo queue. More... | |
RZ_API void | rz_th_queue_free (RZ_NULLABLE RzThreadQueue *queue) |
Frees a RzThreadQueue structure. More... | |
RZ_API bool | rz_th_queue_push (RZ_NONNULL RzThreadQueue *queue, RZ_NONNULL void *user, bool tail) |
Pushes a new element into the queue. More... | |
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. More... | |
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. More... | |
RZ_API bool | rz_th_queue_is_empty (RZ_NONNULL RzThreadQueue *queue) |
Returns true if the queue is empty (thread-safe) More... | |
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) More... | |
RZ_API void rz_th_queue_free | ( | RZ_NULLABLE RzThreadQueue * | queue | ) |
Frees a RzThreadQueue structure.
queue | The RzThreadQueue to free |
Definition at line 55 of file thread_queue.c.
References free(), queue, rz_list_free(), rz_th_cond_free(), and rz_th_lock_free().
Referenced by rz_bin_file_strings(), and rz_th_queue_new().
RZ_API bool rz_th_queue_is_empty | ( | RZ_NONNULL RzThreadQueue * | queue | ) |
Returns true if the queue is empty (thread-safe)
queue | The RzThreadQueue to check |
Definition at line 148 of file thread_queue.c.
References queue, rz_return_val_if_fail, rz_th_lock_enter(), and rz_th_lock_leave().
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)
queue | The RzThreadQueue to check |
Definition at line 164 of file thread_queue.c.
References queue, rz_list_length(), rz_return_val_if_fail, rz_th_lock_enter(), rz_th_lock_leave(), and RZ_THREAD_QUEUE_UNLIMITED.
RZ_API RZ_OWN RzThreadQueue* rz_th_queue_new | ( | size_t | max_size, |
RZ_NULLABLE RzListFree | qfree | ||
) |
Allocates and initializes a new fifo queue.
max_size | The maximum size of the queue, use RZ_THREAD_QUEUE_UNLIMITED for an unlimited size |
qfree | Pointer to a custom free function to free the queue if not empty. |
Definition at line 32 of file thread_queue.c.
References NULL, queue, rz_list_newf(), RZ_NEW0, rz_th_cond_new(), rz_th_lock_new(), and rz_th_queue_free().
Referenced by rz_bin_file_strings().
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.
queue | The RzThreadQueue to push to |
tail | When true, pops the element from the tail, otherwise from the head |
Definition at line 102 of file thread_queue.c.
References NULL, queue, rz_list_pop(), rz_list_pop_head(), rz_return_val_if_fail, rz_th_lock_enter(), and rz_th_lock_leave().
Referenced by search_string_thread_runner().
RZ_API bool rz_th_queue_push | ( | RZ_NONNULL RzThreadQueue * | queue, |
RZ_NONNULL void * | user, | ||
bool | tail | ||
) |
Pushes a new element into the queue.
queue | The RzThreadQueue to push to |
user | The non-null pointer to push to the queue |
tail | When true, appends the element to the tail, otherwise to the head |
Definition at line 75 of file thread_queue.c.
References NULL, queue, rz_list_append(), rz_list_length(), rz_list_prepend(), rz_return_val_if_fail, rz_th_cond_signal(), rz_th_lock_enter(), and rz_th_lock_leave().
Referenced by rz_bin_file_strings().
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.
queue | The RzThreadQueue to push to |
tail | When true, pops the element from the tail, otherwise from the head |
Definition at line 124 of file thread_queue.c.
References NULL, queue, rz_list_pop(), rz_list_pop_head(), rz_return_val_if_fail, rz_th_cond_wait(), rz_th_lock_enter(), and rz_th_lock_leave().