void UniversalInsertNode( List *l, Node *n, bool (*f)(Node *n,Node *m) )
InsertNodeFromHead()
or InsertNodeFromTail()
, the position at which it is added is determined by its priority. The UniversalInsertNode()
procedure allows tasks to arrange list nodes according to values other than priority.
UniversalInsertNode()
uses a comparison function provided by the calling task to determine where to insert a new node. It compares the node to be inserted with nodes already in the list, beginning with the first node. If the comparison function returns TRUE, the new node is inserted immediately before the node to which it was compared. If the comparison function never returns TRUE, the new node becomes the last node in the list. The comparison function, whose arguments are pointers to two nodes, can use any data in the nodes for the comparison.
AddHead
(), AddTail(), InsertNodeFromHead(), InsertNodeFromTail(), RemHead(), RemNode(), RemTail()