diff options
author | Josh Blum <josh@joshknows.com> | 2011-01-26 11:34:21 -0800 |
---|---|---|
committer | Josh Blum <josh@joshknows.com> | 2011-01-26 11:34:21 -0800 |
commit | 789cca28e8f920be56840b29e6e8cf0db1ba61aa (patch) | |
tree | 97d7a059bd0970c9e9bcf1962f46d4a797b85c2e /host/include | |
parent | bf25ec24adc6e4d1aa563962452630628dad3215 (diff) | |
download | uhd-789cca28e8f920be56840b29e6e8cf0db1ba61aa.tar.gz uhd-789cca28e8f920be56840b29e6e8cf0db1ba61aa.tar.bz2 uhd-789cca28e8f920be56840b29e6e8cf0db1ba61aa.zip |
uhd: use boost typedef for scoped_lock
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/transport/bounded_buffer.ipp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp index f7915d866..4fbe3f085 100644 --- a/host/include/uhd/transport/bounded_buffer.ipp +++ b/host/include/uhd/transport/bounded_buffer.ipp @@ -22,6 +22,7 @@ #include <boost/function.hpp> #include <boost/circular_buffer.hpp> #include <boost/thread/condition.hpp> +#include <boost/thread/locks.hpp> #include <boost/date_time/posix_time/posix_time_types.hpp> namespace uhd{ namespace transport{ namespace{ /*anon*/ @@ -36,7 +37,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE bool push_with_pop_on_full(const elem_type &elem){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); if(_buffer.full()){ _buffer.pop_back(); _buffer.push_front(elem); @@ -53,7 +54,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE void push_with_wait(const elem_type &elem){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); _full_cond.wait(lock, _not_full_fcn); _buffer.push_front(elem); lock.unlock(); @@ -61,7 +62,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); if (not _full_cond.timed_wait( lock, to_time_dur(timeout), _not_full_fcn )) return false; @@ -72,7 +73,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE void pop_with_wait(elem_type &elem){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); _empty_cond.wait(lock, _not_empty_fcn); elem = this->pop_back(); lock.unlock(); @@ -80,7 +81,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); if (not _empty_cond.timed_wait( lock, to_time_dur(timeout), _not_empty_fcn )) return false; @@ -91,7 +92,7 @@ namespace uhd{ namespace transport{ namespace{ /*anon*/ } UHD_INLINE void clear(void){ - boost::unique_lock<boost::mutex> lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); while (not_empty()) this->pop_back(); lock.unlock(); _full_cond.notify_one(); |