QUE_prev
Application Program Interface
2-349
C Interface
Syntax
elem = QUE_prev(qelem);
Parameters
Ptr
qelem;
/* element in queue */
Return Value
Ptr
elem;
/* previous element in queue */
Description
QUE_prev returns elem which points to the element in the queue before
qelem.
The qelem parameter is a pointer to an existing element of the QUE. The
return value, elem, is a pointer to the previous element in the QUE. Such
elements have a structure defined similarly to that in the example in the
QUE Module topic. The first field in the structure must be of type
QUE_Elem and is used as an internal pointer.
Since QUE queues are implemented as doubly linked lists with a dummy
node at the head, it is possible for QUE_prev to return a pointer to the
queue itself. Be careful not to call QUE_remove(elem) in this case.
Note:
If the queue is shared by multiple tasks, or tasks and SWIs or HWIs,
QUE_prev should be used in conjunction with some mutual exclusion
mechanism (for example, SEM_pend/SEM_post, TSK_disable/
TSK_enable).
See Also
QUE_head
QUE_insert
QUE_next
QUE_remove
QUE_prev
Return previous element in queue (non-atomically)