Supplementing Generated C : Queue Functions

Queue Functions

Queues are implemented as linked lists in the generated code. Each node in the linked list contains a pointer to an element. Access the lists by using the access functions described in the following table.

 
Queue Function
This function removes an element from the head of the queue and puts it into element. The status is TRUE if there was an element to get. If the status is passed as NULL, no status value is returned.

All the queue manipulation is done using memory allocation for elements added to the queue and freeing the memory when the elements are removed or deleted from the queue. The memory allocation and freeing is done automatically so there is no need to preserve the value of element after the q_put() or q_uput() function is called.

The queue manipulation functions work through the update list, so if some elements are put into a queue, they are not in the queue until the end of the step.