Support Boost 1.87
https://github.com/Icinga/icinga2/pull/10278

Index: lib/base/io-engine.hpp
--- lib/base/io-engine.hpp.orig
+++ lib/base/io-engine.hpp
@@ -16,11 +16,16 @@
 #include <utility>
 #include <vector>
 #include <stdexcept>
+#include <boost/context/fixedsize_stack.hpp>
 #include <boost/exception/all.hpp>
 #include <boost/asio/deadline_timer.hpp>
 #include <boost/asio/io_context.hpp>
 #include <boost/asio/spawn.hpp>
 
+#if BOOST_VERSION >= 108700
+#	include <boost/asio/detached.hpp>
+#endif // BOOST_VERSION >= 108700
+
 namespace icinga
 {
 
@@ -100,24 +105,32 @@ class IoEngine (public)
 
 	template <typename Handler, typename Function>
 	static void SpawnCoroutine(Handler& h, Function f) {
-
-		boost::asio::spawn(h,
-			[f](boost::asio::yield_context yc) {
-
+		auto wrapper = [f = std::move(f)](boost::asio::yield_context yc) {
+			try {
+				f(yc);
+			} catch (const std::exception& ex) {
+				Log(LogCritical, "IoEngine") << "Exception in coroutine: " << DiagnosticInformation(ex);
+			} catch (...) {
 				try {
-					f(yc);
-				} catch (const boost::coroutines::detail::forced_unwind &) {
-					// Required for proper stack unwinding when coroutines are destroyed.
-					// https://github.com/boostorg/coroutine/issues/39
-					throw;
-				} catch (const std::exception& ex) {
-					Log(LogCritical, "IoEngine") << "Exception in coroutine: " << DiagnosticInformation(ex);
-				} catch (...) {
 					Log(LogCritical, "IoEngine", "Exception in coroutine!");
+				} catch (...) {
 				}
-			},
-			boost::coroutines::attributes(GetCoroutineStackSize()) // Set a pre-defined stack size.
+
+				// Required for proper stack unwinding when coroutines are destroyed.
+				// https://github.com/boostorg/coroutine/issues/39
+				throw;
+			}
+		};
+
+#if BOOST_VERSION >= 108700
+		boost::asio::spawn(h,
+			std::allocator_arg, boost::context::fixedsize_stack(GetCoroutineStackSize()),
+			std::move(wrapper),
+			boost::asio::detached
 		);
+#else // BOOST_VERSION >= 108700
+		boost::asio::spawn(h, std::move(wrapper), boost::coroutines::attributes(GetCoroutineStackSize()));
+#endif // BOOST_VERSION >= 108700
 	}
 
 	static inline
