upipe/uqueue.h header reference
Upipe thread-safe queue of elements More
Header inclusion [link]
Members [link]
Type [link]
- struct uqueue
Functions [link]
- 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 urefcount *refcount)
- struct upump * uqueue_upump_alloc_push(struct uqueue *uqueue, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque, struct urefcount *refcount)
Macros [link]
Description [link]
Upipe thread-safe queue of elements
Members detail [link]
#define _UPIPE_UQUEUE_H_ [link]
This macro is declared in upipe/uqueue.h source file, line 31.
struct uqueue [link]
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 |
This function is declared in upipe/uqueue.h source file, line 204.
This function cleans up the queue data structure. Please note that it is the caller's responsibility to empty the queue first.
Parameter list:
- uqueue: pointer to a uqueue structure
This function is declared in upipe/uqueue.h source file, line 78.
This function initializes a uqueue.
Parameter 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
This function is declared in upipe/uqueue.h source file, line 194.
This function returns the number of elements in the queue.
Parameter list:
- uqueue: pointer to a uqueue structure
#define uqueue_pop(uqueue, type) [link]
This macro is declared in upipe/uqueue.h source file, line 186.
This macro pops an element from the queue with type checking.
Parameter 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
This function is declared in upipe/uqueue.h source file, line 137.
This function pushes an element into the queue.
Parameter 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
#define uqueue_sizeof(length) [link]
This macro is declared in upipe/uqueue.h source file, line 65.
This macro returns the required size of extra data space for uqueue.
Parameter 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, struct urefcount *refcount) [link]
This function is declared in upipe/uqueue.h source file, line 125.
This function allocates a watcher triggering when data is ready to be popped.
Parameter 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
- refcount: pointer to urefcount structure to increment during callback, or NULL
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, struct urefcount *refcount) [link]
This function is declared in upipe/uqueue.h source file, line 106.
This function allocates a watcher triggering when data is ready to be pushed.
Parameter 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
- refcount: pointer to urefcount structure to increment during callback, or NULL
The return value is pointer to allocated watcher, or NULL in case of failure
This function is for internal use only.
This function is declared in upipe/uqueue.h source file, line 161.
This function pops an element from the queue.
Parameter list:
- uqueue: pointer to a uqueue structure
The return value is pointer to element, or NULL if the LIFO is empty