Home  /  Autodocs  /  exec.library

NAME

Enqueue
insert or append node to a system queue

SYNOPSIS

Enqueue(list, node)
A0 A1

void Enqueue(struct List *, struct Node *);

FUNCTION

Insert or append a node into a system queue. The insertion is performed based on the node priority. It will keep the list properly sorted. New nodes will be inserted in front of the first node with a lower priority. Hence a FIFO queue for nodes of equal priority

WARNING

This function does not arbitrate for access to the list. The calling Task must be the owner of the involved list.

When used to implement a priority queue, Enqueue() will not scale gracefully. The more nodes are added over time, the more effort will be spent to find the node's appropriate place in the queue. Eventually, a tipping point will be crossed and maintaining the queue will progressively require exponentially more time for each new node added. You may want to consider using a different data structure and algorithm which does not suffer from these limitations.

INPUTS

list
a pointer to the system queue header

node
the node to enqueue. This must be a full featured node with type, priority and name fields.

SEE ALSO

AddHead(), AddTail(), Insert(), Remove(), RemHead(), RemTail()