#include "mercury_util_config.h"
Go to the source code of this file.
#define HG_QUEUE_NULL ((void *) 0) |
Create a new double-ended queue.
- Returns
- A new queue, or NULL if it was not possible to allocate the memory.
HG_UTIL_EXPORT void hg_queue_free |
( |
hg_queue_t * |
queue | ) |
|
Destroy a queue.
User is responsible for freeing allocated data that was pushed to the queue.
- Parameters
-
queue | The queue to destroy. |
Add a value to the head of a queue.
- Parameters
-
queue | The queue. |
data | The value to add. |
- Returns
- Non-zero if the value was added successfully, or zero if it was not possible to allocate the memory for the new entry.
Remove a value from the head of a queue.
- Parameters
-
- Returns
- Value that was at the head of the queue, or QUEUE_NULL if the queue is empty.
Read value from the head of a queue, without removing it from the queue.
- Parameters
-
- Returns
- Value at the head of the queue, or QUEUE_NULL if the queue is empty.
Add a value to the tail of a queue.
- Parameters
-
queue | The queue. |
data | The value to add. |
- Returns
- Non-zero if the value was added successfully, or zero if it was not possible to allocate the memory for the new entry.
Remove a value from the tail of a queue.
- Parameters
-
- Returns
- Value that was at the head of the queue, or QUEUE_NULL if the queue is empty.
Read a value from the tail of a queue, without removing it from the queue.
- Parameters
-
- Returns
- Value at the tail of the queue, or QUEUE_NULL if the queue is empty.
HG_UTIL_EXPORT int hg_queue_is_empty |
( |
hg_queue_t * |
queue | ) |
|
Query if any values are currently in a queue.
- Parameters
-
- Returns
- Zero if the queue is not empty, non-zero if the queue is empty.