diff options
author | Josh Blum <josh@joshknows.com> | 2011-06-17 15:37:46 -0700 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-06-17 15:37:46 -0700 |
commit | 5f3635ad0bf464edf0eea58ac94eb71f33d4de1d (patch) | |
tree | 9e91851d80f2d8304c1b334cf778ddad033aa323 | |
parent | 2e401993b5b3e8920017729f4325ff5a51790fa5 (diff) | |
parent | 40d8c22e39e69bbd7a6e459a6022e3d0457672d2 (diff) | |
download | uhd-5f3635ad0bf464edf0eea58ac94eb71f33d4de1d.tar.gz uhd-5f3635ad0bf464edf0eea58ac94eb71f33d4de1d.tar.bz2 uhd-5f3635ad0bf464edf0eea58ac94eb71f33d4de1d.zip |
Merge branch 'master' into next
-rw-r--r-- | host/include/uhd/transport/bounded_buffer.ipp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp index 0d393ad64..9c24005b7 100644 --- a/host/include/uhd/transport/bounded_buffer.ipp +++ b/host/include/uhd/transport/bounded_buffer.ipp @@ -20,6 +20,7 @@ #include <uhd/config.hpp> #include <boost/bind.hpp> +#include <boost/utility.hpp> #include <boost/function.hpp> #include <boost/circular_buffer.hpp> #include <boost/thread/condition.hpp> @@ -27,7 +28,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ - template <typename elem_type> class bounded_buffer_detail{ + template <typename elem_type> class bounded_buffer_detail : boost::noncopyable{ public: bounded_buffer_detail(size_t capacity): @@ -87,7 +88,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ UHD_INLINE bool pop_with_haste(elem_type &elem){ boost::mutex::scoped_lock lock(_mutex); if (_buffer.empty()) return false; - elem = this->pop_back(); + this->pop_back(elem); lock.unlock(); _full_cond.notify_one(); return true; @@ -97,7 +98,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ if (this->pop_with_haste(elem)) return; boost::mutex::scoped_lock lock(_mutex); _empty_cond.wait(lock, _not_empty_fcn); - elem = this->pop_back(); + this->pop_back(elem); lock.unlock(); _full_cond.notify_one(); } @@ -108,7 +109,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ if (not _empty_cond.timed_wait( lock, to_time_dur(timeout), _not_empty_fcn )) return false; - elem = this->pop_back(); + this->pop_back(elem); lock.unlock(); _full_cond.notify_one(); return true; @@ -130,11 +131,10 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ * 2) assign the back element to empty * 3) pop the back to move the counter */ - UHD_INLINE elem_type pop_back(void){ - elem_type elem = _buffer.back(); + UHD_INLINE void pop_back(elem_type &elem){ + elem = _buffer.back(); _buffer.back() = elem_type(); _buffer.pop_back(); - return elem; } static UHD_INLINE boost::posix_time::time_duration to_time_dur(double timeout){ |