diff options
author | Martin Braun <martin.braun@ettus.com> | 2019-10-16 16:21:19 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-11-26 12:21:32 -0800 |
commit | d3a16b702230534f7265613a73204bdb051a458e (patch) | |
tree | 5cd9ace71b187aa2c5d8deb5904b14db28dc7c70 /host/lib/transport | |
parent | dc698b990d368dfb8641b68dbe32a90079b7bd90 (diff) | |
download | uhd-d3a16b702230534f7265613a73204bdb051a458e.tar.gz uhd-d3a16b702230534f7265613a73204bdb051a458e.tar.bz2 uhd-d3a16b702230534f7265613a73204bdb051a458e.zip |
uhd: Replace all occurrences of boost::bind with std::bind
Note: Replacing everything with a lambda would be even better, but that
can't be easily scripted so we'll do this as a first step to reduce the
Boost footprint.
This also removes occurences of #include <boost/bind.hpp>, and makes
sure all usages of std::bind have an #include <functional>. clang-format
wasn't always applied to minimize the changeset in this commit, however,
it was applied to the blocks of #includes.
Due to conflicts with other Boost libraries, the placeholders _1, _2,
etc. could not be directly used, but had to be explicitly called out
(as std::placeholders::_1, etc.). This makes the use of std::bind even
uglier, which serves as another reminder that using std::bind (and even
more so, boost::bind) should be avoided.
nirio/rpc/rpc_client.cpp still contains a reference to boost::bind. It
was not possible to remove it by simply doing a search and replace, so
it will be removed in a separate commit.
Diffstat (limited to 'host/lib/transport')
-rw-r--r-- | host/lib/transport/libusb1_base.cpp | 4 | ||||
-rw-r--r-- | host/lib/transport/libusb1_zero_copy.cpp | 7 | ||||
-rw-r--r-- | host/lib/transport/muxed_zero_copy_if.cpp | 3 | ||||
-rw-r--r-- | host/lib/transport/nirio/rpc/rpc_client.cpp | 5 | ||||
-rw-r--r-- | host/lib/transport/zero_copy_flow_ctrl.cpp | 2 |
5 files changed, 11 insertions, 10 deletions
diff --git a/host/lib/transport/libusb1_base.cpp b/host/lib/transport/libusb1_base.cpp index 03ab51770..3362de712 100644 --- a/host/lib/transport/libusb1_base.cpp +++ b/host/lib/transport/libusb1_base.cpp @@ -11,9 +11,9 @@ #include <uhd/types/serial.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/tasks.hpp> -#include <boost/bind.hpp> #include <boost/thread/mutex.hpp> #include <cstdlib> +#include <functional> #include <iostream> #include <mutex> #include <memory> @@ -37,7 +37,7 @@ public: UHD_ASSERT_THROW(libusb_init(&_context) == 0); libusb_set_debug(_context, debug_level); task_handler = task::make( - boost::bind(&libusb_session_impl::libusb_event_handler_task, this, _context)); + std::bind(&libusb_session_impl::libusb_event_handler_task, this, _context)); } virtual ~libusb_session_impl(void); diff --git a/host/lib/transport/libusb1_zero_copy.cpp b/host/lib/transport/libusb1_zero_copy.cpp index 356d247cb..d02f90217 100644 --- a/host/lib/transport/libusb1_zero_copy.cpp +++ b/host/lib/transport/libusb1_zero_copy.cpp @@ -12,14 +12,13 @@ #include <uhd/transport/buffer_pool.hpp> #include <uhd/transport/usb_zero_copy.hpp> #include <uhd/utils/log.hpp> -#include <boost/bind.hpp> #include <boost/circular_buffer.hpp> #include <boost/format.hpp> -#include <functional> -#include <memory> #include <boost/thread/condition_variable.hpp> #include <boost/thread/mutex.hpp> +#include <functional> #include <list> +#include <memory> using namespace uhd; using namespace uhd::transport; @@ -253,7 +252,7 @@ public: _mb_pool.push_back(std::make_shared<libusb_zero_copy_mb>(lut, this->get_frame_size(), - boost::bind(&libusb_zero_copy_single::enqueue_buffer, this, _1), + std::bind(&libusb_zero_copy_single::enqueue_buffer, this, std::placeholders::_1), is_recv, name)); diff --git a/host/lib/transport/muxed_zero_copy_if.cpp b/host/lib/transport/muxed_zero_copy_if.cpp index 532c3d3b2..054d74e0c 100644 --- a/host/lib/transport/muxed_zero_copy_if.cpp +++ b/host/lib/transport/muxed_zero_copy_if.cpp @@ -11,6 +11,7 @@ #include <uhd/utils/safe_call.hpp> #include <boost/thread.hpp> #include <boost/thread/locks.hpp> +#include <functional> #include <map> #include <memory> @@ -35,7 +36,7 @@ public: // Create the receive thread to poll the underlying transport // and classify packets into queues _recv_thread = - boost::thread(boost::bind(&muxed_zero_copy_if_impl::_update_queues, this)); + boost::thread(std::bind(&muxed_zero_copy_if_impl::_update_queues, this)); } virtual ~muxed_zero_copy_if_impl() diff --git a/host/lib/transport/nirio/rpc/rpc_client.cpp b/host/lib/transport/nirio/rpc/rpc_client.cpp index 53d336e95..e9bf4bbb4 100644 --- a/host/lib/transport/nirio/rpc/rpc_client.cpp +++ b/host/lib/transport/nirio/rpc/rpc_client.cpp @@ -6,10 +6,11 @@ // #include <uhd/transport/nirio/rpc/rpc_client.hpp> +#include <boost/asio/error.hpp> #include <boost/bind.hpp> -#include <boost/version.hpp> #include <boost/format.hpp> -#include <boost/asio/error.hpp> +#include <boost/version.hpp> + #define CHAIN_BLOCKING_XFER(func, exp, status) \ if (status) { \ diff --git a/host/lib/transport/zero_copy_flow_ctrl.cpp b/host/lib/transport/zero_copy_flow_ctrl.cpp index f92b826db..610d93281 100644 --- a/host/lib/transport/zero_copy_flow_ctrl.cpp +++ b/host/lib/transport/zero_copy_flow_ctrl.cpp @@ -10,7 +10,7 @@ #include <uhd/transport/zero_copy_flow_ctrl.hpp> #include <uhd/utils/log.hpp> #include <uhd/utils/safe_call.hpp> -#include <boost/bind.hpp> +#include <functional> #include <boost/format.hpp> #include <memory> #include <boost/thread/mutex.hpp> |