Coma FW-C2800 User's Guide Page 201

  • Download
  • Add to my manuals
  • Print
  • Page
    / 276
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 200
Queues
Memory and Low-level Functions 5-15
5.3.2 Other QUE Functions
Unlike QUE_get and QUE_put, there are a number of QUE functions that do
not disable interrupts when updating the queue. These functions must be
used in conjunction with some mutual exclusion mechanism if the queues
being modified are shared by multiple threads.
QUE_dequeue and QUE_enqueue are equivalent to QUE_get and QUE_put
except that they do not disable interrupts when updating the queue.
QUE_head is used to return a pointer to the first element in the queue without
removing the element. QUE_next and QUE_prev are used to scan the
elements in the queue—QUE_next returns a pointer to the next element in
the queue and QUE_prev returns a pointer to the previous element in the
queue.
QUE_insert and QUE_remove are used to insert or remove an element from
an arbitrary point within the queue.
Example 5-17. Using QUE Functions with Mutual Exclusion Elements
Note:
Since QUE queues are implemented as doubly linked lists with a header
node, QUE_head, QUE_next, or QUE_prev may return a pointer to the
header node itself (for example, calling QUE_head on an empty queue). Be
careful not to call QUE_remove and remove this header node.
Ptr QUE_dequeue(queue)
QUE_Handle queue;
Void QUE_enqueue(queue, elem)
QUE_Handle queue;
Ptr elem;
Ptr QUE_head(queue)
QUE_Handle queue;
Ptr QUE_next(qelem)
Ptr qelem;
Ptr QUE_prev(qelem)
Ptr qelem;
Void QUE_insert(qelem, elem)
Ptr qelem;
Ptr elem;
Void QUE_remove(qelem)
Ptr qelem;
Page view 200
1 2 ... 196 197 198 199 200 201 202 203 204 205 206 ... 275 276

Comments to this Manuals

No comments