From a63e1dfacdeee3e3249df94f237d6064e126a2e9 Mon Sep 17 00:00:00 2001 From: TomZ Date: Fri, 12 Feb 2021 11:49:29 +0100 Subject: [PATCH] Re-add backwards compatibility hack for old boost --- external/NetworkManager_p.h | 3 ++- external/boost_compat.h | 32 ++++++++++++++++++++++++ external/utils/WaitUntilFinishedHelper.h | 6 ++--- 3 files changed, 37 insertions(+), 4 deletions(-) create mode 100644 external/boost_compat.h diff --git a/external/NetworkManager_p.h b/external/NetworkManager_p.h index c0168a4..1d69af4 100644 --- a/external/NetworkManager_p.h +++ b/external/NetworkManager_p.h @@ -30,6 +30,7 @@ #include "NetworkEndPoint.h" #include "NetworkConnection.h" +#include "boost_compat.h" #include #include @@ -225,7 +226,7 @@ public: void recycleConnection(); - boost::asio::io_context::strand m_strand; + BoostCompatStrand m_strand; /// move a call to the thread that the strand represents void runOnStrand(const std::function &function); diff --git a/external/boost_compat.h b/external/boost_compat.h new file mode 100644 index 0000000..bff6bc5 --- /dev/null +++ b/external/boost_compat.h @@ -0,0 +1,32 @@ +/* + * This file is part of the Flowee project + * Copyright (C) 2018 Tom Zander + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#ifndef FLOWEE_BOOST_COMPAT +#define FLOWEE_BOOST_COMPAT + +#include + +// boost didn't leave much of backwards compatibility in this one. +#if BOOST_VERSION < 106600 +# define BoostCompatStrand boost::asio::strand +# include +#else +# define BoostCompatStrand boost::asio::io_context::strand +# include +#endif + +#endif diff --git a/external/utils/WaitUntilFinishedHelper.h b/external/utils/WaitUntilFinishedHelper.h index bb1dbb3..1a9f02b 100644 --- a/external/utils/WaitUntilFinishedHelper.h +++ b/external/utils/WaitUntilFinishedHelper.h @@ -16,8 +16,8 @@ * along with this program. If not, see . */ +#include "../boost_compat.h" #include -#include #include #include @@ -30,7 +30,7 @@ class WaitUntilFinishedHelper { public: - WaitUntilFinishedHelper(const std::function &target, boost::asio::io_context::strand *strand); + WaitUntilFinishedHelper(const std::function &target, BoostCompatStrand *strand); WaitUntilFinishedHelper(const WaitUntilFinishedHelper &other); ~WaitUntilFinishedHelper(); @@ -41,7 +41,7 @@ private: mutable std::mutex mutex; std::function target; std::atomic ref; - boost::asio::io_context::strand *strand; + BoostCompatStrand *strand; }; Private *d; -- 2.30.1