From df0ae475f782814c95d4f9be166aaffbcc7d47b1 Mon Sep 17 00:00:00 2001
From: eb <eb@221aa14e-8319-0410-a670-987f0aec2ac5>
Date: Thu, 19 Jun 2008 00:06:42 +0000
Subject: Merged eb/gcell-wip -r8559:8571 into trunk.  The shared queue
 structure is slightly modified, and the spu dequeue has been streamlined.  In
 addition, the spu Lost-Lock Line Reservation event is now work correctly,
 though it is still disabled because it's slower than the expontial backoff
 alternative.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@8618 221aa14e-8319-0410-a670-987f0aec2ac5
---
 gcell/src/lib/runtime/gc_jd_queue.c | 36 ++++++++++++++++--------------------
 1 file changed, 16 insertions(+), 20 deletions(-)

(limited to 'gcell/src/lib/runtime/gc_jd_queue.c')

diff --git a/gcell/src/lib/runtime/gc_jd_queue.c b/gcell/src/lib/runtime/gc_jd_queue.c
index 29b74c29d6..b5cdcac9bb 100644
--- a/gcell/src/lib/runtime/gc_jd_queue.c
+++ b/gcell/src/lib/runtime/gc_jd_queue.c
@@ -28,10 +28,9 @@
 void 
 gc_jd_queue_init(gc_jd_queue_t *q)
 {
-  _mutex_init(ptr_to_ea(&q->m.mutex));
-  q->l.head = 0;
-  q->l.tail = 0;
-  q->f.flag = 0;
+  _mutex_init(ptr_to_ea(&q->mutex));
+  q->head = 0;
+  q->tail = 0;
   smp_wmb();
 }
   
@@ -39,44 +38,41 @@ void
 gc_jd_queue_enqueue(gc_jd_queue_t *q, gc_job_desc_t *item)
 {
   item->sys.next = 0;
-  _mutex_lock(ptr_to_ea(&q->m.mutex));
+  _mutex_lock(ptr_to_ea(&q->mutex));
   smp_rmb();		// import barrier
 
-  if (q->l.tail == 0){    // currently empty
-    q->l.tail = q->l.head = jdp_to_ea(item);
+  if (q->tail == 0){    // currently empty
+    q->tail = q->head = jdp_to_ea(item);
   }
   else {		// not empty, append
-    ea_to_jdp(q->l.tail)->sys.next = jdp_to_ea(item);
-    q->l.tail = jdp_to_ea(item);
+    ea_to_jdp(q->tail)->sys.next = jdp_to_ea(item);
+    q->tail = jdp_to_ea(item);
   }
 
   smp_wmb();		// orders stores above before clearing of mutex
-  _mutex_unlock(ptr_to_ea(&q->m.mutex));
-
-  // let SPE's know we wrote something if they've got a lock-line reservation
-  q->f.flag = 1;
+  _mutex_unlock(ptr_to_ea(&q->mutex));
 }
 
 gc_job_desc_t *
 gc_jd_queue_dequeue(gc_jd_queue_t *q)
 {
-  _mutex_lock(ptr_to_ea(&q->m.mutex));
+  _mutex_lock(ptr_to_ea(&q->mutex));
   smp_rmb();		// import barrier
   
-  gc_eaddr_t item_ea = q->l.head;
+  gc_eaddr_t item_ea = q->head;
   if (item_ea == 0){	// empty
-    _mutex_unlock(ptr_to_ea(&q->m.mutex));
+    _mutex_unlock(ptr_to_ea(&q->mutex));
     return 0;
   }
 
-  q->l.head = ea_to_jdp(item_ea)->sys.next;
-  if (q->l.head == 0)	// now emtpy
-    q->l.tail = 0;
+  q->head = ea_to_jdp(item_ea)->sys.next;
+  if (q->head == 0)	// now emtpy
+    q->tail = 0;
 
   gc_job_desc_t *item = ea_to_jdp(item_ea);
   item->sys.next = 0;
 
   smp_wmb();		// orders stores above before clearing of mutex
-  _mutex_unlock(ptr_to_ea(&q->m.mutex));
+  _mutex_unlock(ptr_to_ea(&q->mutex));
   return item;
 }
-- 
cgit v1.2.3