#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
#include <boost/context/detail/exchange.hpp>
#endif
+#include <boost/context/detail/externc.hpp>
#if defined(BOOST_NO_CXX17_STD_INVOKE)
#include <boost/context/detail/invoke.hpp>
#endif
# include BOOST_ABI_PREFIX
#endif
-#if defined(BOOST_USE_ASAN)
-extern "C" {
-void __sanitizer_start_switch_fiber( void **, const void *, size_t);
-void __sanitizer_finish_switch_fiber( void *, const void **, size_t *);
-}
-#endif
-
-#if defined(BOOST_USE_SEGMENTED_STACKS)
-extern "C" {
-void __splitstack_getcontext( void * [BOOST_CONTEXT_SEGMENTS]);
-void __splitstack_setcontext( void * [BOOST_CONTEXT_SEGMENTS]);
-}
-#endif
-
namespace boost {
namespace context {
namespace detail {
try {
// invoke context-function
#if defined(BOOST_NO_CXX17_STD_INVOKE)
- c = invoke( fn_, std::move( c) );
+ c = boost::context::detail::invoke( fn_, std::move( c) );
#else
c = std::invoke( fn_, std::move( c) );
#endif
return * this;
}
- continuation resume() {
+ continuation resume() & {
+ return std::move( * this).resume();
+ }
+
+ continuation resume() && {
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
detail::activation_record * ptr = detail::exchange( ptr_, nullptr)->resume();
#else
ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
- return continuation{ ptr };
+ return { ptr };
+ }
+
+ template< typename Fn >
+ continuation resume_with( Fn && fn) & {
+ return std::move( * this).resume_with( std::forward< Fn >( fn) );
}
template< typename Fn >
- continuation resume_with( Fn && fn) {
+ continuation resume_with( Fn && fn) && {
#if defined(BOOST_NO_CXX14_STD_EXCHANGE)
detail::activation_record * ptr =
detail::exchange( ptr_, nullptr)->resume_with< continuation >( std::forward< Fn >( fn) );
ptr = detail::activation_record::current()->ontop( ptr);
detail::activation_record::current()->ontop = nullptr;
}
- return continuation{ ptr };
+ return { ptr };
}
explicit operator bool() const noexcept {