commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 83/148: added timeout to ring wait calls


From: git
Subject: [Commit-gnuradio] [gnuradio] 83/148: added timeout to ring wait calls
Date: Mon, 15 Aug 2016 00:47:27 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

nwest pushed a commit to annotated tag old_usrp_devel_udp
in repository gnuradio.

commit 5e1e2339274b087b2064271cd92256d01db962d0
Author: Josh Blum <address@hidden>
Date:   Tue Dec 15 18:31:29 2009 -0800

    added timeout to ring wait calls
---
 usrp2/host/lib/eth_data_transport.cc | 4 ++--
 usrp2/host/lib/ring.cc               | 8 ++++----
 usrp2/host/lib/ring.h                | 4 ++--
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/usrp2/host/lib/eth_data_transport.cc 
b/usrp2/host/lib/eth_data_transport.cc
index e8928d9..628c6ae 100644
--- a/usrp2/host/lib/eth_data_transport.cc
+++ b/usrp2/host/lib/eth_data_transport.cc
@@ -101,7 +101,7 @@ void usrp2::eth_data_transport::recv_bg(void){
             d_eth_data->release_frame(rd.base);
         }
     }
-    d_ring->wait_for_empty();
+    d_ring->wait_for_empty(gruel::get_new_timeout(0.1)); //magic timeout in sec
 }
 
 void usrp2::eth_data_transport::recv_loop(){
@@ -145,7 +145,7 @@ bool usrp2::eth_data_transport::sendv(const iovec *iov, 
size_t iovlen){
 }
 
 void usrp2::eth_data_transport::recv(data_handler *handler){
-    d_ring->wait_for_not_empty();
+    d_ring->wait_for_not_empty(gruel::get_new_timeout(0.1)); //magic timeout 
in sec
     while (true){
         ring_data rd;
         DEBUG_LOG("-");
diff --git a/usrp2/host/lib/ring.cc b/usrp2/host/lib/ring.cc
index 9765497..286caa2 100644
--- a/usrp2/host/lib/ring.cc
+++ b/usrp2/host/lib/ring.cc
@@ -34,19 +34,19 @@ namespace usrp2 {
   {/*NOP*/}
 
   void 
-  ring::wait_for_empty() 
+  ring::wait_for_empty(boost::system_time timeout)
   { 
     gruel::scoped_lock l(d_mutex);
     while (not empty()) 
-      d_empty_cond.wait(l);
+      d_empty_cond.timed_wait(l, timeout);
   }
 
   void 
-  ring::wait_for_not_empty() 
+  ring::wait_for_not_empty(boost::system_time timeout)
   { 
     gruel::scoped_lock l(d_mutex);
     while (empty()) 
-      d_not_empty_cond.wait(l);
+      d_not_empty_cond.timed_wait(l, timeout);
   }
 
   bool
diff --git a/usrp2/host/lib/ring.h b/usrp2/host/lib/ring.h
index 8672f82..2a91dcc 100644
--- a/usrp2/host/lib/ring.h
+++ b/usrp2/host/lib/ring.h
@@ -76,8 +76,8 @@ namespace usrp2 {
 
     ring(unsigned int entries);
 
-    void wait_for_empty();
-    void wait_for_not_empty();
+    void wait_for_empty(boost::system_time timeout);
+    void wait_for_not_empty(boost::system_time timeout);
 
     bool enqueue(const ring_data &rd);
     bool dequeue(ring_data &rd);



reply via email to

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