[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

The list functions discussed so far do not make use of the priority field
in a Node. The Enqueue() function is equivalent to Insert(), except it
inserts nodes into a list sorting them according to their priority.  It
keeps the higher-priority nodes towards the head of the list.  All nodes
passed to this function must have their priority and name assigned prior
to the call. Enqueue(header,mynode) inserts mynode behind the lowest
priority node with a priority greater than or equal to mynode's. For
Enqueue() to work properly, the list must already be sort according to
priority.  Because the highest priority node is at the head of the list,
the RemHead() function will remove the highest-priority node.  Likewise,
RemTail() will remove the lowest-priority node.

    FIFO Is Used For The Same Priority.
    If you add a node that has the same priority as another node in the
    queue, Enqueue() will use FIFO ordering.  The new node is inserted
    following the last node of equal priority.

[Back to Amiga Developer Docs]