Skip to content

Commit

Permalink
Merge pull request #266 from petk/patch-trailing-whitespace
Browse files Browse the repository at this point in the history
Trim redundant trailing whitespace
  • Loading branch information
olk authored Dec 26, 2024
2 parents 46effe4 + a62f6a9 commit b7ff6fc
Show file tree
Hide file tree
Showing 32 changed files with 109 additions and 109 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
./b2 -j 3 libs/context/test toolset=$TOOLSET cxxstd=$CXXSTD
fi
#
#
# osx:
# strategy:
# fail-fast: false
Expand All @@ -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: ""
Expand All @@ -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: ""
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
2 changes: 1 addition & 1 deletion doc/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -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 ;
Expand Down
8 changes: 4 additions & 4 deletions example/callcc/echosse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}


Expand Down
8 changes: 4 additions & 4 deletions example/fiber/echosse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}


Expand Down
12 changes: 6 additions & 6 deletions include/boost/context/continuation_ucontext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ struct BOOST_CONTEXT_DECL activation_record {
activation_record( stack_context sctx_) noexcept :
sctx( sctx_ ),
main_ctx( false ) {
}
}

virtual ~activation_record() {
}
Expand Down Expand Up @@ -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 };
}
Expand Down Expand Up @@ -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 * >(
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -515,7 +515,7 @@ class BOOST_CONTEXT_DECL continuation {
}

#endif

template<
typename Fn,
typename = detail::disable_overload< continuation, Fn >
Expand Down
16 changes: 8 additions & 8 deletions include/boost/context/continuation_winfib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) ) {
Expand Down Expand Up @@ -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 };
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -426,7 +426,7 @@ class BOOST_CONTEXT_DECL continuation {
}

#endif

template<
typename Fn,
typename = detail::disable_overload< continuation, Fn >
Expand Down
4 changes: 2 additions & 2 deletions include/boost/context/detail/apply.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 >{}) )
Expand Down
2 changes: 1 addition & 1 deletion include/boost/context/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion include/boost/context/detail/invoke.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 >
Expand Down
6 changes: 3 additions & 3 deletions include/boost/context/fiber_fcontext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand All @@ -396,7 +396,7 @@ class fiber {
}

#endif

inline
void swap( fiber & l, fiber & r) noexcept {
l.swap( r);
Expand Down
6 changes: 3 additions & 3 deletions include/boost/context/fiber_ucontext.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 };
}
Expand Down Expand Up @@ -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 * >(
Expand Down
Loading

0 comments on commit b7ff6fc

Please sign in to comment.