Fix for Boost 1.73

This commit is contained in:
Carles Fernandez 2020-06-06 20:07:00 +02:00
parent cd2dfe0bc2
commit d2e9b0aece
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 11 additions and 5 deletions

View File

@ -746,7 +746,7 @@ if(Boost_VERSION_STRING VERSION_LESS 1.73)
endif()
# Workaround for https://github.com/boostorg/format/issues/67
if(Boost_VERSION_STRING VERSION_GREATER 1.71)
if((Boost_VERSION_STRING VERSION_GREATER 1.71) AND (Boost_VERSION_STRING VERSION_LESS 1.73))
set(CMAKE_CXX_STANDARD 17)
endif()

View File

@ -21,7 +21,7 @@
#include "rtl_tcp_signal_source_c.h"
#include "rtl_tcp_commands.h"
#include <boost/bind.hpp>
#include <boost/bind/bind.hpp>
#include <boost/thread/thread.hpp>
#include <glog/logging.h>
#include <map>
@ -135,13 +135,13 @@ rtl_tcp_signal_source_c::rtl_tcp_signal_source_c(const std::string &address,
// 6. Start reading
#if BOOST_173_OR_GREATER
boost::bind(&rtl_tcp_signal_source_c::handle_read, this, boost::placeholders::_1, boost::placeholders::_2));
boost::asio::async_read(socket_, boost::asio::buffer(data_),
boost::bind(&rtl_tcp_signal_source_c::handle_read, this, boost::placeholders::_1, boost::placeholders::_2)); // NOLINT(modernize-avoid-bind)
#else
boost::asio::async_read(socket_, boost::asio::buffer(data_),
boost::bind(&rtl_tcp_signal_source_c::handle_read, this, _1, _2)); // NOLINT(modernize-avoid-bind)
#endif
boost::thread(
#if HAS_GENERIC_LAMBDA
[ObjectPtr = &io_context_] { ObjectPtr->run(); });
@ -318,10 +318,16 @@ void rtl_tcp_signal_source_c::handle_read(const boost::system::error_code &ec,
}
// let woker know that more data is available
not_empty_.notify_one();
// Read some more
// Read some more
#if BOOST_173_OR_GREATER
boost::asio::async_read(socket_,
boost::asio::buffer(data_),
boost::bind(&rtl_tcp_signal_source_c::handle_read, this, boost::placeholders::_1, boost::placeholders::_2)); // NOLINT(modernize-avoid-bind)
#else
boost::asio::async_read(socket_,
boost::asio::buffer(data_),
boost::bind(&rtl_tcp_signal_source_c::handle_read, this, _1, _2)); // NOLINT(modernize-avoid-bind)
#endif
}
}