Skip to content

Commit

Permalink
Second take to fix the breaking change in boost 1.86
Browse files Browse the repository at this point in the history
  • Loading branch information
jgaa committed Sep 23, 2024
1 parent f6144b1 commit 5470ee3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion include/restc-cpp/restc-cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
throw; /* required for Boost Coroutine! */ \
} catch (...)

#if BOOST_VERSION >= 108100
// They changed the function signature. In boost 1.86 it broke the build.
#define RESTC_CPP_SPAWN_TRAILER \
, boost::asio::detached
#else
#define RESTC_CPP_SPAWN_TRAILER
#endif

namespace restc_cpp {

class RestClient;
Expand Down Expand Up @@ -421,7 +429,7 @@ class RestClient {
prom->set_exception(std::current_exception());
}
done_handler.reset();
}, boost::asio::detached);
} RESTC_CPP_SPAWN_TRAILER);

return future;
}
Expand Down
4 changes: 2 additions & 2 deletions src/RestClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ class RestClientImpl final : public RestClient {
void Process(const prc_fn_t& fn) override {
boost::asio::spawn(*io_service_,
bind(&RestClientImpl::ProcessInWorker, this,
placeholders::_1, fn, nullptr), boost::asio::detached);
placeholders::_1, fn, nullptr) RESTC_CPP_SPAWN_TRAILER);
}

future< void > ProcessWithPromise(const prc_fn_t& fn) override {
Expand All @@ -351,7 +351,7 @@ class RestClientImpl final : public RestClient {

boost::asio::spawn(*io_service_,
bind(&RestClientImpl::ProcessInWorker, this,
placeholders::_1, fn, promise), boost::asio::detached);
placeholders::_1, fn, promise) RESTC_CPP_SPAWN_TRAILER);

return future;
}
Expand Down

0 comments on commit 5470ee3

Please sign in to comment.