diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2019-12-05 15:12:59 +0900 |
commit | b8cf34c691623e4ec329053cbbf68522a855882d (patch) | |
tree | 34da08632a99677f6b79ecb65e5b655a5b69a67f /boost/context/continuation_ucontext.hpp | |
parent | 3fdc3e5ee96dca5b11d1694975a65200787eab86 (diff) | |
download | boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.gz boost-b8cf34c691623e4ec329053cbbf68522a855882d.tar.bz2 boost-b8cf34c691623e4ec329053cbbf68522a855882d.zip |
Imported Upstream version 1.67.0upstream/1.67.0
Diffstat (limited to 'boost/context/continuation_ucontext.hpp')
-rw-r--r-- | boost/context/continuation_ucontext.hpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/boost/context/continuation_ucontext.hpp b/boost/context/continuation_ucontext.hpp index 030d3e9ed6..b2682cf47f 100644 --- a/boost/context/continuation_ucontext.hpp +++ b/boost/context/continuation_ucontext.hpp @@ -37,6 +37,7 @@ extern "C" { #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 @@ -52,20 +53,6 @@ extern "C" { # 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 { @@ -266,7 +253,7 @@ public: 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 @@ -408,7 +395,11 @@ public: 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 @@ -420,11 +411,16 @@ public: 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) ); @@ -438,7 +434,7 @@ public: ptr = detail::activation_record::current()->ontop( ptr); detail::activation_record::current()->ontop = nullptr; } - return continuation{ ptr }; + return { ptr }; } explicit operator bool() const noexcept { |