Important: The information in this document is obsolete and should not be used for new development.
OTReverseList
Reverses the order in which entries are linked in a list.C INTERFACE
OTLink* OTReverseList (OTLink* link)C++ INTERFACE
None. C++ applications use the C interface to this function.PARAMETERS
link
- A link that points to the linked list whose elements you want to reverse; typically, this is the return value from the function
OTLIFOStealList.
- function result
- A pointer to the first entry in the list referenced by the
link
parameter after the list's elements have been reordered.DISCUSSION
This function does not reverse the list atomically. However, it is intended to be used after using theOTLIFOStealList
function, to convert the list produced by that function into a usable FIFO list. A typical usage would be:
OTLink* link; OTLink* next; while ( (link = OTLIFOStealList(&myLifo)) != NULL ) { link = OTReverseList(link); do { MyObject* temp = OTGetLinkObject(link, MyObject, fMyLink); next = link->fNext; /* Do some stuff with temp */ } while ( (link = next) != NULL ); }This allows a producing task to be placing elements into a LIFO list, while a consuming task atomically processes them in FIFO order.If link is
nil
,OTReverseList
returnsnil
.