Skip to content

Commit 31e2cce

Browse files
committed
Don't use removed boost::asio::spawn() overload if Boost >= v1.87
1 parent a9f993a commit 31e2cce

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

lib/base/io-engine.hpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <utility>
1515
#include <vector>
1616
#include <stdexcept>
17+
#include <boost/context/fixedsize_stack.hpp>
1718
#include <boost/exception/all.hpp>
1819
#include <boost/asio/deadline_timer.hpp>
1920
#include <boost/asio/io_context.hpp>
@@ -100,6 +101,10 @@ class IoEngine
100101
static void SpawnCoroutine(Handler& h, Function f) {
101102

102103
boost::asio::spawn(h,
104+
#if BOOST_VERSION >= 108700
105+
std::allocator_arg_t(),
106+
boost::context::fixedsize_stack(GetCoroutineStackSize()),
107+
#endif // BOOST_VERSION >= 108700
103108
[f](boost::asio::yield_context yc) {
104109

105110
try {
@@ -116,8 +121,10 @@ class IoEngine
116121
// https://github.com/boostorg/coroutine/issues/39
117122
throw;
118123
}
119-
},
120-
boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
124+
}
125+
#if BOOST_VERSION < 108700
126+
, boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
127+
#endif // BOOST_VERSION < 108700
121128
);
122129
}
123130

0 commit comments

Comments
 (0)