commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8854 - usrp2/branches/features/host-ng/host-ng/lib


From: jcorgan
Subject: [Commit-gnuradio] r8854 - usrp2/branches/features/host-ng/host-ng/lib
Date: Wed, 9 Jul 2008 20:14:08 -0600 (MDT)

Author: jcorgan
Date: 2008-07-09 20:14:07 -0600 (Wed, 09 Jul 2008)
New Revision: 8854

Modified:
   usrp2/branches/features/host-ng/host-ng/lib/ring.h
   usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
Log:
Fix condition variable usage, still deadlocking

Modified: usrp2/branches/features/host-ng/host-ng/lib/ring.h
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/ring.h  2008-07-10 01:15:18 UTC 
(rev 8853)
+++ usrp2/branches/features/host-ng/host-ng/lib/ring.h  2008-07-10 02:14:07 UTC 
(rev 8854)
@@ -66,7 +66,10 @@
     ring(unsigned int entries);
 
     bool not_empty() const { return d_ring[d_head].d_base != 0; }
-    void wait() { d_cond.wait(); }
+    void wait() { 
+      omni_mutex_lock l(d_mutex);
+      d_cond.wait(); 
+    }
 
     bool enqueue(void *p, size_t len);
     bool dequeue(void **p, size_t *len);

Modified: usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc
===================================================================
--- usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc   2008-07-10 
01:15:18 UTC (rev 8853)
+++ usrp2/branches/features/host-ng/host-ng/lib/usrp2_impl.cc   2008-07-10 
02:14:07 UTC (rev 8854)
@@ -407,9 +407,11 @@
       // Wait for user API thread(s) to process all enqueued packets.
       // The channel ring thread that decrements d_num_enqueued to zero 
       // will signal this thread to continue.
-      while(d_num_enqueued > 0)
-       d_bg_pending_cond.wait();
-      d_enqueued_mutex.unlock();
+      {
+        omni_mutex_lock l(d_enqueued_mutex);
+        while(d_num_enqueued > 0)
+         d_bg_pending_cond.wait();
+      }
     }
   }
   
@@ -532,6 +534,7 @@
     while (!rp->not_empty()) {
       DEBUG_LOG("W");
       rp->wait();
+      DEBUG_LOG("s");
     }
     
     // Iterate through frames and present to user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]