next up previous contents index
Next: 10.2.4 debug.h: debugging support Up: 10.2 Machine-independent Facilities Previous: 10.2.2 spin_lock.h: Spin locks

10.2.3 queue.h: Generic queues

 

SYNOPSIS

#include <oskit/queue.h>

struct queue_entry  {

		struct queue_entry	*next;		/* next element */
		struct queue_entry	*prev;		/* previous element */
	 
};

typedef struct queue_entry *queue_t ;
typedef struct queue_entry queue_head_t ;
typedef struct queue_entry queue_chain_t ;
typedef struct queue_entry *queue_entry_t ;

DESCRIPTION

Macros and structures for implementation of a ``queue'' data type. The implementation uses a doubly-linked list and supports operations to insert and delete anywhere in the list.

queue_init(q)
  Initialize the given queue.
queue_first(q)
  Returns the first entry in the queue.
queue_next(q)
  Returns the entry after an item in the queue.
queue_last(q)
  Returns the last entry in the queue.
queue_prev(q)
  Returns the entry before an item in the queue.
queue_end(q, qe)
  Tests whether a new entry is really the end of the queue.
queue_empty(q)
  Tests whether a queue is empty.
queue_enter(q, elt, type, field)
  Insert a new element at the tail of the queue.
queue_enter_first(head, elt, type, field)
  Insert a new element at the head of the queue.
queue_enter_before(head, nelt, elt, type, field)
  Insert a new element before the indicated element.
queue_enter_after(head, pelt, elt, type, field)
  Insert a new element after the indicated element.
queue_remove(head, elt, type, field)
  Remove an arbitrary item from the queue.
queue_remove_first(head, entry, type, field)
  Remove and return the entry at the head of the queue.
queue_remove_last(head, entry, type, field)
  Remove and return the entry at the tail of the queue.
queue_assign(to, from, type, field)
  Move an element in a queue to a new piece of memory.
queue_iterate(head, elt, type, field)
  Iterate over each item in the queue. Generates a 'for' loop, setting elt to each item in turn (by reference).

This header file is taken from CMU's Mach kernel.


next up previous contents index
Next: 10.2.4 debug.h: debugging support Up: 10.2 Machine-independent Facilities Previous: 10.2.2 spin_lock.h: Spin locks

University of Utah Flux Research Group