From e73c25fb9226029f0e50052b1ffacedb3a78622b Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Mon, 24 Jan 2011 00:34:28 -0800 Subject: gruel thread simplification: Removed get_new_timeout from thread.h (usrp2_vrt carryover) Basically it was created because of a misunderstanding of the time types; and its only ever called once. This also removes thread.cc Call posix_time::milliseconds in usrp2 control.cc. Notice that it passes a time_duration rather than a ptime (aka system time). Added #include to gr_buffer.h. It turns out that boost posix_time.hpp implicitly included the deque header which was missing from gr_buffer.h Replaced the include for thread.hpp with only the includes for the boost thread types mentioned in gruel/thread.h. Also, making use of the scoped_lock typedef that comes with boost thread locks. boost 3.5 safe. --- usrp2/host/lib/control.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'usrp2') diff --git a/usrp2/host/lib/control.cc b/usrp2/host/lib/control.cc index 33a95c078..3b5533eb8 100644 --- a/usrp2/host/lib/control.cc +++ b/usrp2/host/lib/control.cc @@ -27,6 +27,9 @@ #include #include +#include +namespace pt = boost::posix_time; + namespace usrp2 { pending_reply::pending_reply(unsigned int rid, void *buffer, size_t len) @@ -44,10 +47,9 @@ namespace usrp2 { pending_reply::wait_for_completion(double secs) { gruel::scoped_lock l(d_mutex); - boost::system_time to(gruel::get_new_timeout(secs)); while (!d_complete) { - if (!d_cond.timed_wait(l, to)) + if (!d_cond.timed_wait(l, pt::milliseconds(long(secs*1e3)))) return 0; // timed out } -- cgit From 47a87580034ee78feb7ce5bbd3b1f9f6806d375d Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Sun, 13 Mar 2011 17:22:22 -0400 Subject: Adding test to use free or munmap to USRP2 ethernet buffer. --- usrp2/host/lib/eth_buffer.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'usrp2') diff --git a/usrp2/host/lib/eth_buffer.cc b/usrp2/host/lib/eth_buffer.cc index bd37061fd..e8ca05283 100644 --- a/usrp2/host/lib/eth_buffer.cc +++ b/usrp2/host/lib/eth_buffer.cc @@ -156,8 +156,12 @@ namespace usrp2 { { // if we have background thread, stop it here - if (!d_using_tpring && d_buf) + if(d_buf) { + if (!d_using_tpring) free(d_buf); + else + munmap(d_buf, d_buflen); + } return d_ethernet->close(); } -- cgit