diff options
author | Josh Blum | 2011-01-24 00:34:28 -0800 |
---|---|---|
committer | Josh Blum | 2011-02-27 19:58:32 -0800 |
commit | e73c25fb9226029f0e50052b1ffacedb3a78622b (patch) | |
tree | b480f83b5b614f67b4c544f955fb85b3c338762e /usrp2/host/lib | |
parent | a02bb131f68d5aa66093310c393562671e389778 (diff) | |
download | gnuradio-e73c25fb9226029f0e50052b1ffacedb3a78622b.tar.gz gnuradio-e73c25fb9226029f0e50052b1ffacedb3a78622b.tar.bz2 gnuradio-e73c25fb9226029f0e50052b1ffacedb3a78622b.zip |
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 <deque> 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.
Diffstat (limited to 'usrp2/host/lib')
-rw-r--r-- | usrp2/host/lib/control.cc | 6 |
1 files changed, 4 insertions, 2 deletions
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 <iostream> #include <gruel/thread.h> +#include <boost/date_time/posix_time/posix_time.hpp> +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 } |