Skip to content

Commit

Permalink
Fix issue #89: Remove the symbol BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele77 committed Jan 24, 2021
1 parent f8abeb6 commit 29fef14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions include/cli/detail/newboostasiolib.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
#define CLI_DETAIL_NEWBOOSTASIOLIB_H_

#include <boost/version.hpp>

#if BOOST_VERSION >= 107400
#define BOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT
#endif

#include <boost/asio.hpp>

namespace cli
Expand All @@ -61,7 +56,12 @@ class NewBoostAsioLib
executor(socket.get_executor()) {}
template <typename T> void Post(T&& t) { boost::asio::post(executor, std::forward<T>(t)); }
private:
boost::asio::executor executor;
#if BOOST_VERSION >= 107400
using AsioExecutor = boost::asio::any_io_executor;
#else
using AsioExecutor = boost::asio::executor;
#endif
AsioExecutor executor;
};

static boost::asio::ip::address IpAddressFromString(const std::string& address)
Expand Down
12 changes: 6 additions & 6 deletions include/cli/detail/newstandaloneasiolib.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,6 @@
#define CLI_DETAIL_NEWSTANDALONEASIOLIB_H_

#include <asio/version.hpp>

#if ASIO_VERSION >= 101700
#define ASIO_USE_TS_EXECUTOR_AS_DEFAULT
#endif

#include <asio.hpp>

namespace cli
Expand All @@ -61,7 +56,12 @@ class NewStandaloneAsioLib
executor(socket.get_executor()) {}
template <typename T> void Post(T&& t) { asio::post(executor, std::forward<T>(t)); }
private:
asio::executor executor;
#if ASIO_VERSION >= 101700
using AsioExecutor = asio::any_io_executor;
#else
using AsioExecutor = asio::executor;
#endif
AsioExecutor executor;
};

static asio::ip::address IpAddressFromString(const std::string& address)
Expand Down

2 comments on commit 29fef14

@k-morozov
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx, this pr helps me to resolve executor's bug (boost 1.74)

@daniele77
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@k-morozov great!
Also, check out the new features of v. 2.0.
If you like the library, please add a star to the project, share it with other developers, and -- if you can -- support the project by becoming a sponsor!

Please sign in to comment.