fix bugs in multicore version runtime
[IRC.git] / Robust / src / Runtime / Queue.c
index a058d3f1e72a46be01c352a8c0e1f512e67ed668..adb35e8dad35a69f498cdb587cc6c91959ba8595 100644 (file)
@@ -101,6 +101,10 @@ 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;
 }
@@ -114,6 +118,9 @@ void * getItem(struct Queue * queue) {
     q->next->prev=NULL;
   }
   queue->head=q->next;
+  if(queue->tail == q) {
+         queue->tail = NULL;
+  }
   RUNFREE(q);
   return ptr;
 }