blob: d336da9f054b0f48e434d20669ef92134301bc6c [file] [log] [blame]
--- boost/context/continuation.hpp
+++ boost/context/continuation.hpp
@@ -299,6 +299,24 @@
friend continuation
callcc( std::allocator_arg_t, preallocated, StackAlloc, Fn &&);
+#if defined(BOOST_GCC) && BOOST_GCC < 50000
+ template< typename StackAlloc, typename Fn, typename ... Arg >
+ friend continuation
+ callcc_with_args( std::allocator_arg_t, StackAlloc, Fn &&, Arg ...);
+
+ template< typename StackAlloc, typename Fn, typename ... Arg >
+ friend continuation
+ callcc_with_args_palloc( std::allocator_arg_t, preallocated, StackAlloc, Fn &&, Arg ...);
+
+ template< typename StackAlloc, typename Fn >
+ friend continuation
+ callcc_no_args( std::allocator_arg_t, StackAlloc, Fn &&);
+
+ template< typename StackAlloc, typename Fn >
+ friend continuation
+ callcc_no_args_palloc( std::allocator_arg_t, preallocated, StackAlloc, Fn &&);
+#endif
+
detail::transfer_t t_{ nullptr, nullptr };
continuation( detail::fcontext_t fctx) noexcept :
@@ -518,6 +536,56 @@
palloc, salloc, std::forward< Fn >( fn) ) }.resume();
}
+#if defined(BOOST_GCC) && BOOST_GCC < 50000
+
+template<
+ typename StackAlloc,
+ typename Fn,
+ typename ... Arg
+>
+continuation
+callcc_with_args( std::allocator_arg_t, StackAlloc salloc, Fn && fn, Arg ... arg) {
+ using Record = detail::record< continuation, StackAlloc, Fn >;
+ return continuation{
+ detail::context_create< Record >(
+ salloc, std::forward< Fn >( fn) ) }.resume(
+ std::forward< Arg >( arg) ... );
+}
+
+template<
+ typename StackAlloc,
+ typename Fn,
+ typename ... Arg
+>
+continuation
+callcc_with_args_palloc( std::allocator_arg_t, preallocated palloc, StackAlloc salloc, Fn && fn, Arg ... arg) {
+ using Record = detail::record< continuation, StackAlloc, Fn >;
+ return continuation{
+ detail::context_create< Record >(
+ palloc, salloc, std::forward< Fn >( fn) ) }.resume(
+ std::forward< Arg >( arg) ... );
+}
+
+template< typename StackAlloc, typename Fn >
+continuation
+callcc_no_args( std::allocator_arg_t, StackAlloc salloc, Fn && fn) {
+ using Record = detail::record< continuation, StackAlloc, Fn >;
+ return continuation{
+ detail::context_create< Record >(
+ salloc, std::forward< Fn >( fn) ) }.resume();
+}
+
+template< typename StackAlloc, typename Fn >
+continuation
+callcc_no_args_palloc( std::allocator_arg_t, preallocated palloc, StackAlloc salloc, Fn && fn) {
+ using Record = detail::record< continuation, StackAlloc, Fn >;
+ return continuation{
+ detail::context_create< Record >(
+ palloc, salloc, std::forward< Fn >( fn) ) }.resume();
+}
+
+#endif
+
#if defined(BOOST_USE_SEGMENTED_STACKS)
template<
typename Fn,
--- libs/fiber/src/context.cpp
+++ libs/fiber/src/context.cpp
@@ -219,7 +219,11 @@
type_{ type::dispatcher_context },
policy_{ launch::post }
{
+#if defined(BOOST_GCC) && BOOST_GCC < 50000
+ c_ = boost::context::callcc_no_args_palloc(
+#else
c_ = boost::context::callcc(
+#endif
std::allocator_arg, palloc, salloc,
[this,sched](boost::context::continuation && c) noexcept {
c = c.resume();