diff options
author | Trung Tran <trung.tran@ettus.com> | 2018-06-17 16:37:20 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2018-06-18 12:53:57 -0500 |
commit | 5753bc307149f31979dc588f848801c71b331815 (patch) | |
tree | fb8cfec42fe7caec42edaa9a1a7d295c2e180db8 /host/lib/transport | |
parent | 67b5827faecd3dc3d9977dff7366b8ea2ab4c87a (diff) | |
download | uhd-5753bc307149f31979dc588f848801c71b331815.tar.gz uhd-5753bc307149f31979dc588f848801c71b331815.tar.bz2 uhd-5753bc307149f31979dc588f848801c71b331815.zip |
liberio_zero_copy: add tx and rx mutexes
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/liberio_zero_copy.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/host/lib/transport/liberio_zero_copy.cpp b/host/lib/transport/liberio_zero_copy.cpp index 8914cccdb..0999d78cf 100644 --- a/host/lib/transport/liberio_zero_copy.cpp +++ b/host/lib/transport/liberio_zero_copy.cpp @@ -12,6 +12,7 @@ #include <liberio/liberio.h> #include <boost/make_shared.hpp> #include <sys/syslog.h> +#include <mutex> namespace uhd { namespace transport { @@ -204,6 +205,7 @@ public: managed_recv_buffer::sptr get_recv_buff(double timeout = 0.1) { + std::lock_guard<std::mutex> lock(_rx_mutex); if (_next_recv_buff_index == _num_recv_bufs) _next_recv_buff_index = 0; return _mrb_pool[_next_recv_buff_index]->get_new( @@ -221,7 +223,8 @@ public: } managed_send_buffer::sptr get_send_buff(double timeout = 0.1) - { + { + std::lock_guard<std::mutex> lock(_tx_mutex); if (_next_send_buff_index == _num_send_bufs) _next_send_buff_index = 0; return _msb_pool[_next_send_buff_index]->get_new( @@ -250,6 +253,8 @@ private: size_t _next_recv_buff_index; std::vector<boost::shared_ptr<liberio_zero_copy_msb> > _msb_pool; size_t _next_send_buff_index; + std::mutex _rx_mutex; + std::mutex _tx_mutex; }; liberio_zero_copy::sptr liberio_zero_copy::make( |