upipe/uqueue.h header reference
Upipe thread-safe queue of elements More
Header inclusion
Members
Type
- struct uqueue
Functions
- void uqueue_clean(struct uqueue *uqueue)
- bool uqueue_init(struct uqueue *uqueue, uint8_t length, void *extra)
- unsigned int uqueue_length(struct uqueue *uqueue)
- bool uqueue_push(struct uqueue *uqueue, void *element)
- struct upump * uqueue_upump_alloc_pop(struct uqueue *uqueue, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque)
- struct upump * uqueue_upump_alloc_push(struct uqueue *uqueue, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque)
Macros
Description
Members detail
This macro is declared in upipe/uqueue.h source file, line 31.
This struct is declared in upipe/uqueue.h source file, line 48.
This struct is the implementation of a queue.
Field | Description |
---|---|
struct ufifo fifo; | FIFO |
uatomic_uint32_t counter; | number of elements in the queue |
uint32_t length; | maximum number of elements in the queue |
struct ueventfd event_push; | ueventfd triggered when data can be pushed |
struct ueventfd event_pop; | ueventfd triggered when data can be popped |
void uqueue_clean(struct uqueue *uqueue)
This function is declared in upipe/uqueue.h source file, line 196.
This function cleans up the queue data structure. Please note that it is the caller's responsibility to empty the queue first.
Parameters list:
- uqueue: pointer to a uqueue structure
bool uqueue_init(struct uqueue *uqueue, uint8_t length, void *extra)
This function is declared in upipe/uqueue.h source file, line 78.
This function initializes a uqueue.
Parameters list:
- uqueue: pointer to a uqueue structure
- length: maximum number of elements in the queue
- extra: mandatory extra space allocated by the caller, with the size returned by ufifo_sizeof
The return value is false in case of failure
unsigned int uqueue_length(struct uqueue *uqueue)
This function is declared in upipe/uqueue.h source file, line 186.
This function returns the number of elements in the queue.
Parameters list:
- uqueue: pointer to a uqueue structure
This macro is declared in upipe/uqueue.h source file, line 178.
This macro pops an element from the queue with type checking.
Parameters list:
- uqueue: pointer to a uqueue structure
- type: type of the opaque pointer
The return value is pointer to element, or NULL if the LIFO is empty
bool uqueue_push(struct uqueue *uqueue, void *element)
This function is declared in upipe/uqueue.h source file, line 129.
This function pushes an element into the queue.
Parameters list:
- uqueue: pointer to a uqueue structure
- element: pointer to element to push
The return value is false if the queue is full and the element couldn't be queued
This macro is declared in upipe/uqueue.h source file, line 65.
This macro returns the required size of extra data space for uqueue.
Parameters list:
- length: maximum number of elements in the queue
The return value is size in octets to allocate
struct upump * uqueue_upump_alloc_pop(struct uqueue *uqueue, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque)
This function is declared in upipe/uqueue.h source file, line 118.
This function allocates a watcher triggering when data is ready to be popped.
Parameters list:
- uqueue: pointer to a uqueue structure
- upump_mgr: management structure for this event loop
- cb: function to call when the watcher triggers
- opaque: pointer to the module's internal structure
The return value is pointer to allocated watcher, or NULL in case of failure
struct upump * uqueue_upump_alloc_push(struct uqueue *uqueue, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque)
This function is declared in upipe/uqueue.h source file, line 103.
This function allocates a watcher triggering when data is ready to be pushed.
Parameters list:
- uqueue: pointer to a uqueue structure
- upump_mgr: management structure for this event loop
- cb: function to call when the watcher triggers
- opaque: pointer to the module's internal structure
The return value is pointer to allocated watcher, or NULL in case of failure
void * uqueue_pop_internal(struct uqueue *uqueue)
This function is for internal use only.
This function is declared in upipe/uqueue.h source file, line 153.
This function pops an element from the queue.
Parameters list:
- uqueue: pointer to a uqueue structure
The return value is pointer to element, or NULL if the LIFO is empty