A priority queue.
More...
A priority queue.
Implementation based on a heap data structure
priority queue
Definition at line 29 of file pqueue.h.
Frees all memory allocated by the priority queue.
- Parameters
-
q | The priority queue to destroy. |
Creates a new priority queue.
- Returns
- A priority queue of initial length 0.
Returns true if queue is empty.
- Parameters
-
- Returns
- 1 if the queue is empty, 0 otherwise.
size_t pqueue_length |
( |
pqueue_t const * |
q | ) |
|
Get the length of the priority queue.
- Parameters
-
- Returns
- The length of the queue.
Returns and removes the first element, i.e.
that one with the highest priority, from the queue.
- Parameters
-
- Returns
- The first element of the queue. Asserts if queue is empty.
void pqueue_put |
( |
pqueue_t * |
q, |
|
|
void * |
data, |
|
|
int |
priority |
|
) |
| |
Inserts a new element into a priority queue.
- Parameters
-
q | The priority queue the element should be inserted to. |
data | The actual data which should be stored in the queue. |
priority | The priority for the data. |