vsync / queue / vqueue_prio_stack_tree_based.h
Macros
| Macro | Description |
|---|---|
| VQUEUE_PRIO_PRIORITY_RANGE | VQUEUE_PRIO_PRIORITY_RANGE configures the queue to accept priorities from [0:VQUEUE_PRIO_PRIORITY_RANGE-1] |
Macro VQUEUE_PRIO_PRIORITY_RANGE
VQUEUE_PRIO_PRIORITY_RANGE configures the queue to accept priorities from [0:VQUEUE_PRIO_PRIORITY_RANGE-1]
Note:
VQUEUE_PRIO_PRIORITY_RANGEmust be power of two.
Functions
| Function | Description |
|---|---|
| vqueue_prio_init | Initializes the queue. |
| vqueue_prio_destroy | Calls the given callback on all remaining nodes. |
| vqueue_prio_add | Enqueues the given node. |
| vqueue_prio_remove_min | Dequeues a node with highest priority available. |
Function vqueue_prio_init
static void vqueue_prio_init(vqueue_prio_t *pqueue, vqueue_prio_handle_node_t retire_cb, void *retire_cb_arg, backoff_rand_fun_t rand_fun)
Initializes the queue.
Parameters:
pqueue: address of vqueue_prio_t object.retire_cb: callback function used for retiring detached nodes to the SMR.retire_cb_arg: second parameter ofretire_cb.rand_fun: a function pointer to a function that generates a random number.
Function vqueue_prio_destroy
static void vqueue_prio_destroy(vqueue_prio_t *pqueue, vqueue_prio_handle_node_t destroy_cb, void *args)
Calls the given callback on all remaining nodes.
Nodes can be freed in destroy_cb
Note: this is not thread safe and must be called if and only if all threads are done accessing the queue
Parameters:
pqueue: address of vqueue_prio_t object.destroy_cb: address of a callback function to call on each remaining node.args: second argument ofdestroy_cb.
Function vqueue_prio_add
static void vqueue_prio_add(vqueue_prio_t *pqueue, vqueue_prio_node_t *pnode, vsize_t priority)
Enqueues the given node.
Parameters:
pqueue: address of vqueue_prio_t object.node: address of vqueue_prio_node_t object.priority: the priority associated withnode.
Function vqueue_prio_remove_min
static vqueue_prio_node_t* vqueue_prio_remove_min(vqueue_prio_t *pqueue)
Dequeues a node with highest priority available.
Parameters:
pqueue: address of vqueue_prio_t object.
Returns: vqueue_prio_node_t* address of dequeued object.