diff options
Diffstat (limited to 'host/include')
-rw-r--r-- | host/include/uhd/transport/bounded_buffer.ipp | 33 | ||||
-rw-r--r-- | host/include/uhd/transport/nirio/nirio_fifo.h | 8 | ||||
-rw-r--r-- | host/include/uhd/transport/nirio/nirio_fifo.ipp | 16 | ||||
-rw-r--r-- | host/include/uhd/transport/nirio/niusrprio_session.h | 6 | ||||
-rw-r--r-- | host/include/uhd/transport/nirio/rpc/rpc_client.hpp | 10 | ||||
-rw-r--r-- | host/include/uhd/utils/soft_register.hpp | 37 |
6 files changed, 53 insertions, 57 deletions
diff --git a/host/include/uhd/transport/bounded_buffer.ipp b/host/include/uhd/transport/bounded_buffer.ipp index 3e15fc03a..122b3d740 100644 --- a/host/include/uhd/transport/bounded_buffer.ipp +++ b/host/include/uhd/transport/bounded_buffer.ipp @@ -11,9 +11,9 @@ #include <uhd/utils/noncopyable.hpp> #include <boost/circular_buffer.hpp> #include <boost/thread/condition.hpp> -#include <boost/thread/locks.hpp> #include <boost/utility.hpp> #include <functional> +#include <mutex> namespace uhd{ namespace transport{ @@ -30,9 +30,8 @@ namespace uhd{ namespace transport{ UHD_INLINE bool push_with_haste(const elem_type &elem) { - boost::mutex::scoped_lock lock(_mutex); - if (_buffer.full()) - { + std::unique_lock<std::mutex> lock(_mutex); + if (_buffer.full()) { return false; } _buffer.push_front(elem); @@ -42,15 +41,13 @@ namespace uhd{ namespace transport{ UHD_INLINE bool push_with_pop_on_full(const elem_type &elem) { - boost::mutex::scoped_lock lock(_mutex); - if (_buffer.full()) - { + std::lock_guard<std::mutex> lock(_mutex); + if (_buffer.full()) { _buffer.pop_back(); _buffer.push_front(elem); _empty_cond.notify_one(); return false; - } - else { + } else { _buffer.push_front(elem); _empty_cond.notify_one(); return true; @@ -59,7 +56,7 @@ namespace uhd{ namespace transport{ UHD_INLINE void push_with_wait(const elem_type &elem) { - boost::mutex::scoped_lock lock(_mutex); + std::unique_lock<std::mutex> lock(_mutex); if (_buffer.full()) { _full_cond.wait(lock, _not_full_fcn); @@ -70,7 +67,7 @@ namespace uhd{ namespace transport{ UHD_INLINE bool push_with_timed_wait(const elem_type &elem, double timeout) { - boost::mutex::scoped_lock lock(_mutex); + std::unique_lock<std::mutex> lock(_mutex); if (_buffer.full()) { if (not _full_cond.timed_wait(lock, @@ -86,9 +83,8 @@ namespace uhd{ namespace transport{ UHD_INLINE bool pop_with_haste(elem_type &elem) { - boost::mutex::scoped_lock lock(_mutex); - if (_buffer.empty()) - { + std::unique_lock<std::mutex> lock(_mutex); + if (_buffer.empty()) { return false; } this->pop_back(elem); @@ -98,7 +94,7 @@ namespace uhd{ namespace transport{ UHD_INLINE void pop_with_wait(elem_type &elem) { - boost::mutex::scoped_lock lock(_mutex); + std::unique_lock<std::mutex> lock(_mutex); if (_buffer.empty()) { _empty_cond.wait(lock, _not_empty_fcn); @@ -109,9 +105,8 @@ namespace uhd{ namespace transport{ UHD_INLINE bool pop_with_timed_wait(elem_type &elem, double timeout) { - boost::mutex::scoped_lock lock(_mutex); - if (_buffer.empty()) - { + std::unique_lock<std::mutex> lock(_mutex); + if (_buffer.empty()) { if (not _empty_cond.timed_wait(lock, to_time_dur(timeout), _not_empty_fcn)) { @@ -124,7 +119,7 @@ namespace uhd{ namespace transport{ } private: - boost::mutex _mutex; + std::mutex _mutex; boost::condition _empty_cond, _full_cond; boost::circular_buffer<elem_type> _buffer; diff --git a/host/include/uhd/transport/nirio/nirio_fifo.h b/host/include/uhd/transport/nirio/nirio_fifo.h index 0cd9f1906..71b9563c3 100644 --- a/host/include/uhd/transport/nirio/nirio_fifo.h +++ b/host/include/uhd/transport/nirio/nirio_fifo.h @@ -13,12 +13,12 @@ #include <uhd/transport/nirio/niriok_proxy.h> #include <uhd/transport/nirio/status.h> #include <uhd/utils/noncopyable.hpp> -#include <boost/thread/recursive_mutex.hpp> #include <atomic> -#include <string> #include <chrono> +#include <cstdint> +#include <mutex> +#include <string> #include <thread> -#include <stdint.h> namespace uhd { namespace niusrprio { @@ -213,7 +213,7 @@ private: //Members size_t _remaining_in_claimed_block; size_t _remaining_acquirable_elements; nirio_driver_iface::rio_mmap_t _mem_map; - boost::recursive_mutex _mutex; + std::recursive_mutex _mutex; niriok_proxy::sptr _riok_proxy_ptr; uint64_t _expected_xfer_count; diff --git a/host/include/uhd/transport/nirio/nirio_fifo.ipp b/host/include/uhd/transport/nirio/nirio_fifo.ipp index 048616b4c..12058aa70 100644 --- a/host/include/uhd/transport/nirio/nirio_fifo.ipp +++ b/host/include/uhd/transport/nirio/nirio_fifo.ipp @@ -61,7 +61,7 @@ nirio_status nirio_fifo<data_t>::initialize( { nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == UNMAPPED) { @@ -101,7 +101,7 @@ nirio_status nirio_fifo<data_t>::initialize( template <typename data_t> void nirio_fifo<data_t>::finalize() { - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); //If the FIFO is started, the stop will change the state to MAPPED. stop(); @@ -200,7 +200,7 @@ nirio_status nirio_fifo<data_t>::start() nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { //Do nothing. Already started. @@ -237,7 +237,7 @@ nirio_status nirio_fifo<data_t>::stop() nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { @@ -266,7 +266,7 @@ nirio_status nirio_fifo<data_t>::acquire( nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr || _mem_map.is_null()) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { @@ -320,7 +320,7 @@ nirio_status nirio_fifo<data_t>::release(const size_t elements) nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { status = _riok_proxy_ptr->grant_fifo( @@ -345,7 +345,7 @@ nirio_status nirio_fifo<data_t>::read( nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { status = _riok_proxy_ptr->read_fifo( @@ -375,7 +375,7 @@ nirio_status nirio_fifo<data_t>::write( nirio_status status = NiRio_Status_Success; if (!_riok_proxy_ptr) return NiRio_Status_ResourceNotInitialized; - boost::unique_lock<boost::recursive_mutex> lock(_mutex); + std::unique_lock<std::recursive_mutex> lock(_mutex); if (_state == STARTED) { status = _riok_proxy_ptr->write_fifo( diff --git a/host/include/uhd/transport/nirio/niusrprio_session.h b/host/include/uhd/transport/nirio/niusrprio_session.h index 183f766cc..432c3cd90 100644 --- a/host/include/uhd/transport/nirio/niusrprio_session.h +++ b/host/include/uhd/transport/nirio/niusrprio_session.h @@ -13,8 +13,8 @@ #include <uhd/transport/nirio/niriok_proxy.h> #include <uhd/transport/nirio/rpc/usrprio_rpc_client.hpp> #include <uhd/utils/noncopyable.hpp> -#include <stdint.h> -#include <boost/thread/recursive_mutex.hpp> +#include <cstdint> +#include <mutex> #include <string> namespace uhd { namespace niusrprio { @@ -103,7 +103,7 @@ private: niriok_proxy::sptr _riok_proxy; nirio_resource_manager _resource_manager; usrprio_rpc::usrprio_rpc_client _rpc_client; - boost::recursive_mutex _session_mutex; + std::recursive_mutex _session_mutex; }; }} // namespace uhd::niusrprio diff --git a/host/include/uhd/transport/nirio/rpc/rpc_client.hpp b/host/include/uhd/transport/nirio/rpc/rpc_client.hpp index 9361b7276..844e36c76 100644 --- a/host/include/uhd/transport/nirio/rpc/rpc_client.hpp +++ b/host/include/uhd/transport/nirio/rpc/rpc_client.hpp @@ -11,9 +11,11 @@ #include <uhd/utils/log.hpp> #include <uhd/utils/noncopyable.hpp> #include <boost/asio.hpp> -#include <boost/thread/condition_variable.hpp> -#include <boost/thread/thread.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/thread.hpp> +#include <boost/thread/condition.hpp> #include <memory> +#include <mutex> namespace uhd { namespace usrprio_rpc { @@ -76,8 +78,8 @@ private: func_xport_buf_t _request; func_xport_buf_t _response; // Synchronization - boost::mutex _mutex; - boost::condition_variable _exec_gate; + std::mutex _mutex; + boost::condition _exec_gate; boost::system::error_code _exec_err; }; diff --git a/host/include/uhd/utils/soft_register.hpp b/host/include/uhd/utils/soft_register.hpp index e38ffedfe..d23d1b8fb 100644 --- a/host/include/uhd/utils/soft_register.hpp +++ b/host/include/uhd/utils/soft_register.hpp @@ -11,12 +11,11 @@ #include <uhd/types/wb_iface.hpp> #include <uhd/utils/dirty_tracked.hpp> #include <uhd/utils/noncopyable.hpp> -#include <stdint.h> #include <unordered_map> -#include <boost/thread/locks.hpp> -#include <boost/thread/mutex.hpp> #include <boost/tokenizer.hpp> +#include <cstdint> #include <list> +#include <mutex> /*! \file soft_register.hpp * Utilities to access and index hardware registers. @@ -329,48 +328,48 @@ public: UHD_INLINE void initialize(wb_iface& iface, bool sync = false) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); soft_register_t<reg_data_t, readable, writable>::initialize(iface, sync); } UHD_INLINE void set(const soft_reg_field_t field, const reg_data_t value) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); soft_register_t<reg_data_t, readable, writable>::set(field, value); } UHD_INLINE reg_data_t get(const soft_reg_field_t field) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); return soft_register_t<reg_data_t, readable, writable>::get(field); } UHD_INLINE void flush() { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); soft_register_t<reg_data_t, readable, writable>::flush(); } UHD_INLINE void refresh() { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); soft_register_t<reg_data_t, readable, writable>::refresh(); } UHD_INLINE void write(const soft_reg_field_t field, const reg_data_t value) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); soft_register_t<reg_data_t, readable, writable>::write(field, value); } UHD_INLINE reg_data_t read(const soft_reg_field_t field) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); return soft_register_t<reg_data_t, readable, writable>::read(field); } private: - boost::mutex _mutex; + std::mutex _mutex; }; /* @@ -483,7 +482,7 @@ public: */ void initialize(wb_iface& iface, bool sync = false) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); for (soft_register_base* reg : _reglist) { reg->initialize(iface, sync); } @@ -496,7 +495,7 @@ public: */ void flush() { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); for (soft_register_base* reg : _reglist) { reg->flush(); } @@ -509,7 +508,7 @@ public: */ void refresh() { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); for (soft_register_base* reg : _reglist) { reg->refresh(); } @@ -555,7 +554,7 @@ protected: const std::string& name, const visibility_t visible = PRIVATE) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (visible == PUBLIC) { // Only add to the map if this register is publicly visible if (not _regmap.insert(regmap_t::value_type(name, ®)).second) { @@ -573,7 +572,7 @@ private: const std::string _name; regmap_t _regmap; // For lookups reglist_t _reglist; // To maintain order - boost::mutex _mutex; + std::mutex _mutex; }; @@ -611,7 +610,7 @@ public: */ void add(soft_regmap_t& regmap) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); _regmaps.push_back(®map); } @@ -620,7 +619,7 @@ public: */ void add(soft_regmap_db_t& db) { - boost::lock_guard<boost::mutex> lock(_mutex); + std::lock_guard<std::mutex> lock(_mutex); if (&db == this) { throw uhd::assertion_error("cannot add regmap db to itself" + _name); } else { @@ -700,7 +699,7 @@ private: const std::string _name; db_t _regmaps; db_t _regmap_dbs; - boost::mutex _mutex; + std::mutex _mutex; }; } // namespace uhd |