Contiki-NG
|
This library provides functions for the creation and manipulation of queues. More...
Macros | |
#define | QUEUE(name) LIST(name) |
Define a queue. More... | |
Typedefs | |
typedef list_t | queue_t |
The queue data type. | |
Functions | |
static void | queue_init (queue_t queue) |
Initialise a queue. More... | |
static void | queue_enqueue (queue_t queue, void *element) |
Adds an element to the tail of the queue. More... | |
static void * | queue_dequeue (queue_t queue) |
Removes the element at the front of the queue. More... | |
static void * | queue_peek (queue_t queue) |
Returns the front element of the queue, without removing it. More... | |
static bool | queue_is_empty (queue_t queue) |
Check if a queue is empty. More... | |
This library provides functions for the creation and manipulation of queues.
The library is implemented as a wrapper around the list library.
A queue is declared using the QUEUE macro. Queue elements must be allocated by the calling code and must be of a C struct datatype. In this struct, the first field must be a pointer called next. This field will be used by the library to maintain the queue. Application code must not modify this field directly.
#define QUEUE | ( | name | ) | LIST(name) |
Define a queue.
This macro defines a queue.
The datatype for elements must be a C struct. The struct's first member must be a pointer called next. This is used internally by the library to maintain data structure integrity and must not be modified directly by application code.
name | The name of the queue. |
|
inlinestatic |
Removes the element at the front of the queue.
queue | The queue |
If this function returns NULL if the queue was empty (queue underflow)
Definition at line 110 of file queue.h.
References list_pop().
|
inlinestatic |
Adds an element to the tail of the queue.
queue | The queue |
element | A pointer to the element to be added |
Definition at line 97 of file queue.h.
References list_add().
|
inlinestatic |
Initialise a queue.
queue | The queue |
Definition at line 86 of file queue.h.
References list_init().
|
inlinestatic |
|
inlinestatic |
Returns the front element of the queue, without removing it.
queue | The queue |
Definition at line 121 of file queue.h.
References list_head().