}
#endif
+struct QueueItem * getTail(struct Queue * queue) {
+ return queue->tail;
+}
+
+struct QueueItem * getHead(struct Queue * queue) {
+ return queue->head;
+}
+
+struct QueueItem * getNextQueueItem(struct QueueItem * qi) {
+ return qi->next;
+}
+
struct QueueItem * findItem(struct Queue * queue, void *ptr) {
struct QueueItem * item=queue->head;
while(item!=NULL) {
RUNFREE(item);
}
-struct QueueItem * getTail(struct Queue * queue) {
- return queue->tail;
-}
-
-struct QueueItem * getHead(struct Queue * queue) {
- return queue->head;
-}
-
-struct QueueItem * getNextQueueItem(struct QueueItem * qi) {
- return qi->next;
-}
-
void * getItem(struct Queue * queue) {
struct QueueItem * q=queue->head;
void * ptr=q->objectptr;
return ptr;
}
+void * peekItem(struct Queue * queue) {
+ struct QueueItem * q=queue->head;
+ void * ptr=q->objectptr;
+ return ptr;
+}
+
+void * peekItemBack(struct Queue * queue) {
+ struct QueueItem * q=queue->tail;
+ void * ptr=q->objectptr;
+ return ptr;
+}
+
#ifdef DEBUG_QUEUE
int assertQueue(struct Queue * queue) {
#define isEmpty(x) ((x)->head==NULL)
-void * getItem(struct Queue * queue);
-void freeQueue(struct Queue * q);
struct Queue * createQueue();
+void freeQueue(struct Queue * q);
+
struct QueueItem * addNewItem(struct Queue * queue, void * ptr);
+struct QueueItem * addNewItemBack(struct Queue * queue, void * ptr);
#ifdef MULTICORE
struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr);
#endif
-struct QueueItem * findItem(struct Queue * queue, void * ptr);
-void removeItem(struct Queue * queue, struct QueueItem * item);
+
struct QueueItem * getTail(struct Queue * queue);
struct QueueItem * getHead(struct Queue * queue);
struct QueueItem * getNextQueueItem(struct QueueItem * qi);
-// to implement a double-ended queue
+struct QueueItem * findItem(struct Queue * queue, void * ptr);
+
+void removeItem(struct Queue * queue, struct QueueItem * item);
+
+void * getItem(struct Queue * queue);
void * getItemBack(struct Queue * queue);
-struct QueueItem * addNewItemBack(struct Queue * queue, void * ptr);
+
+void * peekItem(struct Queue * queue);
+void * peekItemBack(struct Queue * queue);
// for debugging, only included if macro is defined