From 789cca28e8f920be56840b29e6e8cf0db1ba61aa Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Wed, 26 Jan 2011 11:34:21 -0800 Subject: uhd: use boost typedef for scoped_lock --- host/include/uhd/transport/bounded_buffer.ipp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'host') 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 #include #include +#include #include 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 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 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 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 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 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 lock(_mutex); + boost::mutex::scoped_lock lock(_mutex); while (not_empty()) this->pop_back(); lock.unlock(); _full_cond.notify_one(); -- cgit v1.2.3