My Kernel v0.1.0
Queue
Collaboration diagram for Queue:

Macros

#define __QUEUE_INIT   __LLIST_INIT
 Default value for queue (empty)
 
#define __INIT_QUEUE   __INIT_LLIST
 Initialize an empty queue.
 
#define DECLARE_QUEUE   DECLARE_LLIST
 Declare an empty queue.
 

Typedefs

typedef llist_t queue_t
 A queue instance. More...
 

Functions

static bool queue_is_empty (const queue_t *queue)
 
static void queue_enqueue (queue_t *queue, node_t *new)
 Insert the new element as the tail of the queue.
 
static node_tqueue_dequeue (queue_t *queue)
 Pop the head from the queue. More...
 
static const node_tqueue_peek (const queue_t *queue)
 
static void queue_enqueue_all (queue_t *queue, llist_t *elements)
 Insert all the elements of a list into a queue. More...
 

Detailed Description

Typedef Documentation

◆ queue_t

typedef llist_t queue_t

Our queue is just a wrapper around a Linked List

Function Documentation

◆ queue_dequeue()

static node_t * queue_dequeue ( queue_t queue)
inlinestatic
Returns
The popped head, or NULL if empty

◆ queue_enqueue_all()

static void queue_enqueue_all ( queue_t queue,
llist_t elements 
)
inlinestatic

After this operation, elements is empty.

◆ queue_is_empty()

static bool queue_is_empty ( const queue_t queue)
inlinestatic
Returns
Whether the queue is empty or not

◆ queue_peek()

static const node_t * queue_peek ( const queue_t queue)
inlinestatic
Returns
the current head of the queue