Enqueue(list, node)
void Enqueue(struct List *, struct Node *);
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
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.