diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6b1f65a2..1f515c23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,7 +140,7 @@ jobs: if [ -n "$PACKAGES_TO_REMOVE" ]; then sudo apt-get purge -y $PACKAGES_TO_REMOVE; fi echo ">>>>> APT: REPO.." for i in {1..3}; do sudo -E apt-add-repository -y "ppa:ubuntu-toolchain-r/test" && break || sleep 2; done - + if test -n "${LLVM_OS}" ; then wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add - if test -n "${LLVM_VER}" ; then @@ -194,7 +194,7 @@ jobs: ./b2 -j 3 libs/context/test toolset=$TOOLSET cxxstd=$CXXSTD fi -# +# # osx: # strategy: # fail-fast: false @@ -203,7 +203,7 @@ jobs: # # Github Actions only supports certain Xcode versions # Change (or delete) the Xcode version for this job. -# +# # - name: "TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1 Job 7" # buildtype: "boost" # packages: "" @@ -219,7 +219,7 @@ jobs: # # Github Actions only supports certain Xcode versions # Change (or delete) the Xcode version for this job. -# +# # - name: "TOOLSET=clang COMPILER=clang++ CXXSTD=11,14,1 Job 8" # buildtype: "boost" # packages: "" @@ -232,19 +232,19 @@ jobs: # toolset: "clang" # compiler: "clang++" # cxxstd: "11,14,1z" -# -# +# +# # runs-on: ${{ matrix.os }} -# +# # steps: # - uses: actions/checkout@v2 -# +# # - name: Set DEVELOPER_DIR # if: matrix.xcode_version != '' # run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode_version }}.app/Contents/Developer" >> $GITHUB_ENV # - name: Test DEVELOPER_DIR # run: echo $DEVELOPER_DIR -# +# # - name: "osx" # shell: bash # env: @@ -274,11 +274,11 @@ jobs: # export USER=$(whoami) # export CC=${CC:-gcc} # export PATH=~/.local/bin:/usr/local/bin:$PATH -# +# # if [ "$JOB_BUILDTYPE" == "boost" ]; then -# +# # echo '==================================> INSTALL' -# +# # BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true # cd .. # git clone -b $BOOST_BRANCH https://github.com/boostorg/boost.git boost-root @@ -290,10 +290,10 @@ jobs: # python tools/boostdep/depinst/depinst.py context # ./bootstrap.sh # ./b2 headers -# +# # echo '==================================> SCRIPT' -# +# # echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam # ./b2 -j 3 libs/context/test toolset=$TOOLSET cxxstd=$CXXSTD -# +# # fi diff --git a/README.md b/README.md index 44aeff04..1e3d167d 100644 --- a/README.md +++ b/README.md @@ -2,20 +2,20 @@ boost.context ============= boost.context is a foundational library that provides a sort of cooperative multitasking on a single thread. -By providing an abstraction of the current execution state in the current thread, including the stack (with -local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context -instance represents a specific point in the application's execution path. This is useful for building -higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to +By providing an abstraction of the current execution state in the current thread, including the stack (with +local variables) and stack pointer, all registers and CPU flags, and the instruction pointer, a execution_context +instance represents a specific point in the application's execution path. This is useful for building +higher-level abstractions, like coroutines, cooperative threads (userland threads) or an equivalent to C# keyword yield in C++. -A fiber provides the means to suspend the current execution path and to transfer execution control, -thereby permitting another fiber to run on the current thread. This state full transfer mechanism -enables a fiber to suspend execution from within nested functions and, later, to resume from where it -was suspended. While the execution path represented by a fiber only runs on a single thread, it can be +A fiber provides the means to suspend the current execution path and to transfer execution control, +thereby permitting another fiber to run on the current thread. This state full transfer mechanism +enables a fiber to suspend execution from within nested functions and, later, to resume from where it +was suspended. While the execution path represented by a fiber only runs on a single thread, it can be migrated to another thread at any given time. -A context switch between threads requires system calls (involving the OS kernel), which can cost more than -thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than +A context switch between threads requires system calls (involving the OS kernel), which can cost more than +thousand CPU cycles on x86 CPUs. By contrast, transferring control among fibers requires only fewer than hundred CPU cycles because it does not involve system calls as it is done within a single thread. -boost.context requires C++11! +boost.context requires C++11! diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index c016ed7e..9666e50b 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -1,6 +1,6 @@ # (C) Copyright 2008 Oliver Kowalke # -# Distributed under the Boost Software License, Version 1.0. (See accompanying +# Distributed under the Boost Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) project context/doc ; diff --git a/example/callcc/echosse.cpp b/example/callcc/echosse.cpp index 4b76ffc5..7c91bc2a 100644 --- a/example/callcc/echosse.cpp +++ b/example/callcc/echosse.cpp @@ -19,10 +19,10 @@ void echoSSE( int i) { xmm = _mm_set_epi32( i, i + 1, i + 2, i + 3); uint32_t v32[4]; memcpy( & v32, & xmm, 16); - std::cout << v32[0]; - std::cout << v32[1]; - std::cout << v32[2]; - std::cout << v32[3]; + std::cout << v32[0]; + std::cout << v32[1]; + std::cout << v32[2]; + std::cout << v32[3]; } diff --git a/example/fiber/echosse.cpp b/example/fiber/echosse.cpp index e4f6deba..87c2b525 100644 --- a/example/fiber/echosse.cpp +++ b/example/fiber/echosse.cpp @@ -19,10 +19,10 @@ void echoSSE( int i) { xmm = _mm_set_epi32( i, i + 1, i + 2, i + 3); uint32_t v32[4]; memcpy( & v32, & xmm, 16); - std::cout << v32[0]; - std::cout << v32[1]; - std::cout << v32[2]; - std::cout << v32[3]; + std::cout << v32[0]; + std::cout << v32[1]; + std::cout << v32[2]; + std::cout << v32[3]; } diff --git a/include/boost/context/continuation_ucontext.hpp b/include/boost/context/continuation_ucontext.hpp index 09fd3114..3b74b25c 100644 --- a/include/boost/context/continuation_ucontext.hpp +++ b/include/boost/context/continuation_ucontext.hpp @@ -105,7 +105,7 @@ struct BOOST_CONTEXT_DECL activation_record { activation_record( stack_context sctx_) noexcept : sctx( sctx_ ), main_ctx( false ) { - } + } virtual ~activation_record() { } @@ -264,7 +264,7 @@ class capture_record : public activation_record { c = boost::context::detail::invoke( fn_, std::move( c) ); #else c = std::invoke( fn_, std::move( c) ); -#endif +#endif } catch ( forced_unwind const& ex) { c = Ctx{ ex.from }; } @@ -324,7 +324,7 @@ static activation_record * create_context1( StackAlloc && salloc, Fn && fn) { template< typename Ctx, typename StackAlloc, typename Fn > static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; + typedef capture_record< Ctx, StackAlloc, Fn > capture_t; // reserve space for control structure void * storage = reinterpret_cast< void * >( @@ -478,7 +478,7 @@ class BOOST_CONTEXT_DECL continuation { } #if !defined(BOOST_EMBTC) - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { @@ -490,7 +490,7 @@ class BOOST_CONTEXT_DECL continuation { } #else - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other); @@ -515,7 +515,7 @@ class BOOST_CONTEXT_DECL continuation { } #endif - + template< typename Fn, typename = detail::disable_overload< continuation, Fn > diff --git a/include/boost/context/continuation_winfib.hpp b/include/boost/context/continuation_winfib.hpp index 856c8684..060930c4 100644 --- a/include/boost/context/continuation_winfib.hpp +++ b/include/boost/context/continuation_winfib.hpp @@ -87,7 +87,7 @@ struct BOOST_CONTEXT_DECL activation_record { if ( BOOST_UNLIKELY( nullptr == fiber) ) { DWORD err = ::GetLastError(); BOOST_ASSERT( ERROR_ALREADY_FIBER == err); - fiber = ::GetCurrentFiber(); + fiber = ::GetCurrentFiber(); BOOST_ASSERT( nullptr != fiber); BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber); } @@ -97,7 +97,7 @@ struct BOOST_CONTEXT_DECL activation_record { activation_record( stack_context sctx_) noexcept : sctx{ sctx_ }, main_ctx{ false } { - } + } virtual ~activation_record() { if ( BOOST_UNLIKELY( main_ctx) ) { @@ -227,7 +227,7 @@ class capture_record : public activation_record { c = boost::context::detail::invoke( fn_, std::move( c) ); #else c = std::invoke( fn_, std::move( c) ); -#endif +#endif } catch ( forced_unwind const& ex) { c = Ctx{ ex.from }; } @@ -261,7 +261,7 @@ static activation_record * create_context1( StackAlloc && salloc, Fn && fn) { template< typename Ctx, typename StackAlloc, typename Fn > static activation_record * create_context2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef capture_record< Ctx, StackAlloc, Fn > capture_t; + typedef capture_record< Ctx, StackAlloc, Fn > capture_t; BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size); // reserve space for control structure @@ -387,9 +387,9 @@ class BOOST_CONTEXT_DECL continuation { bool operator<( continuation const& other) const noexcept { return ptr_ < other.ptr_; } - + #if !defined(BOOST_EMBTC) - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other) { @@ -401,7 +401,7 @@ class BOOST_CONTEXT_DECL continuation { } #else - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, continuation const& other); @@ -426,7 +426,7 @@ class BOOST_CONTEXT_DECL continuation { } #endif - + template< typename Fn, typename = detail::disable_overload< continuation, Fn > diff --git a/include/boost/context/detail/apply.hpp b/include/boost/context/detail/apply.hpp index fbf0ca61..55b0dbc2 100644 --- a/include/boost/context/detail/apply.hpp +++ b/include/boost/context/detail/apply.hpp @@ -35,7 +35,7 @@ namespace detail { template< typename Fn, typename Tpl, std::size_t ... I > auto -apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >) +apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >) #if defined(BOOST_NO_CXX17_STD_INVOKE) -> decltype( boost::context::detail::invoke( std::forward< Fn >( fn), std::get< I >( std::forward< Tpl >( tpl) ) ... ) ) #else @@ -51,7 +51,7 @@ apply_impl( Fn && fn, Tpl && tpl, index_sequence< I ... >) template< typename Fn, typename Tpl > auto -apply( Fn && fn, Tpl && tpl) +apply( Fn && fn, Tpl && tpl) -> decltype( apply_impl( std::forward< Fn >( fn), std::forward< Tpl >( tpl), make_index_sequence< std::tuple_size< typename std::decay< Tpl >::type >::value >{}) ) diff --git a/include/boost/context/detail/config.hpp b/include/boost/context/detail/config.hpp index 06737fdf..218d6c30 100644 --- a/include/boost/context/detail/config.hpp +++ b/include/boost/context/detail/config.hpp @@ -96,7 +96,7 @@ defined(BOOST_NO_CXX11_UNIFIED_INITIALISATION_SYNTAX) || \ defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || \ defined(BOOST_NO_HDR_ATOMIC) || \ - defined(BOOST_NO_HDR_TUPLE) + defined(BOOST_NO_HDR_TUPLE) # define BOOST_CONTEXT_NO_CXX11 #endif diff --git a/include/boost/context/detail/invoke.hpp b/include/boost/context/detail/invoke.hpp index 9173cbc7..fee0f185 100644 --- a/include/boost/context/detail/invoke.hpp +++ b/include/boost/context/detail/invoke.hpp @@ -29,7 +29,7 @@ typename std::enable_if< typename std::result_of< Fn &&( Args && ... ) >::type >::type invoke( Fn && fn, Args && ... args) { - return std::mem_fn( fn)( std::forward< Args >( args) ... ); + return std::mem_fn( fn)( std::forward< Args >( args) ... ); } template< typename Fn, typename ... Args > diff --git a/include/boost/context/fiber_fcontext.hpp b/include/boost/context/fiber_fcontext.hpp index a2760cbd..44b2625f 100644 --- a/include/boost/context/fiber_fcontext.hpp +++ b/include/boost/context/fiber_fcontext.hpp @@ -359,7 +359,7 @@ class fiber { } #if !defined(BOOST_EMBTC) - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { @@ -371,7 +371,7 @@ class fiber { } #else - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other); @@ -396,7 +396,7 @@ class fiber { } #endif - + inline void swap( fiber & l, fiber & r) noexcept { l.swap( r); diff --git a/include/boost/context/fiber_ucontext.hpp b/include/boost/context/fiber_ucontext.hpp index 927a1398..459b1076 100644 --- a/include/boost/context/fiber_ucontext.hpp +++ b/include/boost/context/fiber_ucontext.hpp @@ -120,7 +120,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record { fiber_activation_record( stack_context sctx_) noexcept : sctx( sctx_ ), main_ctx( false ) { - } + } virtual ~fiber_activation_record() { #if defined(BOOST_USE_TSAN) @@ -289,7 +289,7 @@ class fiber_capture_record : public fiber_activation_record { c = boost::context::detail::invoke( fn_, std::move( c) ); #else c = std::invoke( fn_, std::move( c) ); -#endif +#endif } catch ( forced_unwind const& ex) { c = Ctx{ ex.from }; } @@ -357,7 +357,7 @@ static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn) template< typename Ctx, typename StackAlloc, typename Fn > static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; + typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; // reserve space for control structure void * storage = reinterpret_cast< void * >( diff --git a/include/boost/context/fiber_winfib.hpp b/include/boost/context/fiber_winfib.hpp index cd496d1b..bb895ac9 100644 --- a/include/boost/context/fiber_winfib.hpp +++ b/include/boost/context/fiber_winfib.hpp @@ -86,7 +86,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record { fiber = ::ConvertThreadToFiber( nullptr); if ( BOOST_UNLIKELY( nullptr == fiber) ) { BOOST_ASSERT( ERROR_ALREADY_FIBER == ::GetLastError()); - fiber = ::GetCurrentFiber(); + fiber = ::GetCurrentFiber(); BOOST_ASSERT( nullptr != fiber); BOOST_ASSERT( reinterpret_cast< LPVOID >( 0x1E00) != fiber); } @@ -96,7 +96,7 @@ struct BOOST_CONTEXT_DECL fiber_activation_record { fiber_activation_record( stack_context sctx_) noexcept : sctx{ sctx_ }, main_ctx{ false } { - } + } virtual ~fiber_activation_record() { if ( BOOST_UNLIKELY( main_ctx) ) { @@ -226,7 +226,7 @@ class fiber_capture_record : public fiber_activation_record { c = boost::context::detail::invoke( fn_, std::move( c) ); #else c = std::invoke( fn_, std::move( c) ); -#endif +#endif } catch ( forced_unwind const& ex) { c = Ctx{ ex.from }; } @@ -260,7 +260,7 @@ static fiber_activation_record * create_fiber1( StackAlloc && salloc, Fn && fn) template< typename Ctx, typename StackAlloc, typename Fn > static fiber_activation_record * create_fiber2( preallocated palloc, StackAlloc && salloc, Fn && fn) { - typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; + typedef fiber_capture_record< Ctx, StackAlloc, Fn > capture_t; BOOST_ASSERT( ( sizeof( capture_t) ) < palloc.size); // reserve space for control structure @@ -390,9 +390,9 @@ class BOOST_CONTEXT_DECL fiber { bool operator<( fiber const& other) const noexcept { return ptr_ < other.ptr_; } - + #if !defined(BOOST_EMBTC) - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other) { @@ -404,7 +404,7 @@ class BOOST_CONTEXT_DECL fiber { } #else - + template< typename charT, class traitsT > friend std::basic_ostream< charT, traitsT > & operator<<( std::basic_ostream< charT, traitsT > & os, fiber const& other); diff --git a/index.html b/index.html index 0ade6cbd..07057214 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ doc/html/index.html
© Copyright Beman Dawes, 2001
-Distributed under the Boost Software +
Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)