diff options
| author | neksard <[email protected]> | 2022-02-10 16:45:33 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:45:33 +0300 |
| commit | 1d9c550e7c38e051d7961f576013a482003a70d9 (patch) | |
| tree | b2cc84ee7850122e7ccf51d0ea21e4fa7e7a5685 /contrib/restricted/boost/libs/coroutine/src | |
| parent | 8f7cf138264e0caa318144bf8a2c950e0b0a8593 (diff) | |
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/boost/libs/coroutine/src')
4 files changed, 345 insertions, 345 deletions
diff --git a/contrib/restricted/boost/libs/coroutine/src/detail/coroutine_context.cpp b/contrib/restricted/boost/libs/coroutine/src/detail/coroutine_context.cpp index e5599d03f40..6a6d5248338 100644 --- a/contrib/restricted/boost/libs/coroutine/src/detail/coroutine_context.cpp +++ b/contrib/restricted/boost/libs/coroutine/src/detail/coroutine_context.cpp @@ -1,82 +1,82 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#include "boost/coroutine/detail/coroutine_context.hpp" - -#include "boost/coroutine/detail/data.hpp" - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable:4355) -#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 coroutines { -namespace detail { - -coroutine_context::coroutine_context() : - palloc_(), - ctx_( 0) -{} - -coroutine_context::coroutine_context( ctx_fn fn, preallocated const& palloc) : - palloc_( palloc), - ctx_( context::detail::make_fcontext( palloc_.sp, palloc_.size, fn) ) -{} - -coroutine_context::coroutine_context( coroutine_context const& other) : - palloc_( other.palloc_), - ctx_( other.ctx_) -{} - -coroutine_context & -coroutine_context::operator=( coroutine_context const& other) -{ - if ( this == & other) return * this; - - palloc_ = other.palloc_; - ctx_ = other.ctx_; - - return * this; -} - -void * -coroutine_context::jump( coroutine_context & other, void * param) -{ -#if defined(BOOST_USE_SEGMENTED_STACKS) - __splitstack_getcontext( palloc_.sctx.segments_ctx); - __splitstack_setcontext( other.palloc_.sctx.segments_ctx); -#endif - data_t data = { this, param }; - context::detail::transfer_t t = context::detail::jump_fcontext( other.ctx_, & data); - data_t * ret = static_cast< data_t * >( t.data); - ret->from->ctx_ = t.fctx; - return ret->data; -} - -}}} - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif + +// Copyright Oliver Kowalke 2009. +// 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) + +#include "boost/coroutine/detail/coroutine_context.hpp" + +#include "boost/coroutine/detail/data.hpp" + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif + +#if defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable:4355) +#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 coroutines { +namespace detail { + +coroutine_context::coroutine_context() : + palloc_(), + ctx_( 0) +{} + +coroutine_context::coroutine_context( ctx_fn fn, preallocated const& palloc) : + palloc_( palloc), + ctx_( context::detail::make_fcontext( palloc_.sp, palloc_.size, fn) ) +{} + +coroutine_context::coroutine_context( coroutine_context const& other) : + palloc_( other.palloc_), + ctx_( other.ctx_) +{} + +coroutine_context & +coroutine_context::operator=( coroutine_context const& other) +{ + if ( this == & other) return * this; + + palloc_ = other.palloc_; + ctx_ = other.ctx_; + + return * this; +} + +void * +coroutine_context::jump( coroutine_context & other, void * param) +{ +#if defined(BOOST_USE_SEGMENTED_STACKS) + __splitstack_getcontext( palloc_.sctx.segments_ctx); + __splitstack_setcontext( other.palloc_.sctx.segments_ctx); +#endif + data_t data = { this, param }; + context::detail::transfer_t t = context::detail::jump_fcontext( other.ctx_, & data); + data_t * ret = static_cast< data_t * >( t.data); + ret->from->ctx_ = t.fctx; + return ret->data; +} + +}}} + +#if defined(_MSC_VER) +# pragma warning(pop) +#endif + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif diff --git a/contrib/restricted/boost/libs/coroutine/src/exceptions.cpp b/contrib/restricted/boost/libs/coroutine/src/exceptions.cpp index 97b4dd5c3bb..d32eb546838 100644 --- a/contrib/restricted/boost/libs/coroutine/src/exceptions.cpp +++ b/contrib/restricted/boost/libs/coroutine/src/exceptions.cpp @@ -1,37 +1,37 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#include "boost/coroutine/exceptions.hpp" - -namespace boost { -namespace coroutines { - -class coroutine_error_category : public system::error_category -{ -public: - virtual const char* name() const BOOST_NOEXCEPT - { return "coroutine"; } - - virtual std::string message( int ev) const - { - switch (BOOST_SCOPED_ENUM_NATIVE(coroutine_errc)(ev)) - { - case coroutine_errc::no_data: - return std::string("Operation not permitted because coroutine " - "has no valid result."); - } - return std::string("unspecified coroutine_errc value\n"); - } -}; - -BOOST_COROUTINES_DECL -system::error_category const& coroutine_category() BOOST_NOEXCEPT -{ - static coroutines::coroutine_error_category cat; - return cat; -} - -}} + +// Copyright Oliver Kowalke 2009. +// 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) + +#include "boost/coroutine/exceptions.hpp" + +namespace boost { +namespace coroutines { + +class coroutine_error_category : public system::error_category +{ +public: + virtual const char* name() const BOOST_NOEXCEPT + { return "coroutine"; } + + virtual std::string message( int ev) const + { + switch (BOOST_SCOPED_ENUM_NATIVE(coroutine_errc)(ev)) + { + case coroutine_errc::no_data: + return std::string("Operation not permitted because coroutine " + "has no valid result."); + } + return std::string("unspecified coroutine_errc value\n"); + } +}; + +BOOST_COROUTINES_DECL +system::error_category const& coroutine_category() BOOST_NOEXCEPT +{ + static coroutines::coroutine_error_category cat; + return cat; +} + +}} diff --git a/contrib/restricted/boost/libs/coroutine/src/posix/stack_traits.cpp b/contrib/restricted/boost/libs/coroutine/src/posix/stack_traits.cpp index 82490e11c57..b629943221f 100644 --- a/contrib/restricted/boost/libs/coroutine/src/posix/stack_traits.cpp +++ b/contrib/restricted/boost/libs/coroutine/src/posix/stack_traits.cpp @@ -1,112 +1,112 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#include "boost/coroutine/stack_traits.hpp" - -extern "C" { -#include <signal.h> -#include <sys/resource.h> -#include <sys/time.h> -#include <unistd.h> -} - -//#if _POSIX_C_SOURCE >= 200112L - -#include <algorithm> -#include <cmath> - -#include <boost/assert.hpp> -#include <boost/thread.hpp> - -#if !defined (SIGSTKSZ) -# define SIGSTKSZ (8 * 1024) -# define UDEF_SIGSTKSZ -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace { - -void pagesize_( std::size_t * size) -{ - // conform to POSIX.1-2001 - * size = ::sysconf( _SC_PAGESIZE); -} - -void stacksize_limit_( rlimit * limit) -{ - // conforming to POSIX.1-2001 -#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) - ::getrlimit( RLIMIT_STACK, limit); -#else - const int result = ::getrlimit( RLIMIT_STACK, limit); - BOOST_ASSERT( 0 == result); -#endif -} - -std::size_t pagesize() -{ - static std::size_t size = 0; - static boost::once_flag flag; - boost::call_once( flag, pagesize_, & size); - return size; -} - -rlimit stacksize_limit() -{ - static rlimit limit; - static boost::once_flag flag; - boost::call_once( flag, stacksize_limit_, & limit); - return limit; -} - -} - -namespace boost { -namespace coroutines { - -bool -stack_traits::is_unbounded() BOOST_NOEXCEPT -{ return RLIM_INFINITY == stacksize_limit().rlim_max; } - -std::size_t -stack_traits::page_size() BOOST_NOEXCEPT -{ return pagesize(); } - -std::size_t -stack_traits::default_size() BOOST_NOEXCEPT -{ - std::size_t size = 8 * minimum_size(); - if ( is_unbounded() ) return size; - - BOOST_ASSERT( maximum_size() >= minimum_size() ); - return maximum_size() == size - ? size - : (std::min)( size, maximum_size() ); -} - -std::size_t -stack_traits::minimum_size() BOOST_NOEXCEPT -{ return SIGSTKSZ; } - -std::size_t -stack_traits::maximum_size() BOOST_NOEXCEPT -{ - BOOST_ASSERT( ! is_unbounded() ); - return static_cast< std::size_t >( stacksize_limit().rlim_max); -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif - -#ifdef UDEF_SIGSTKSZ -# undef SIGSTKSZ -#endif + +// Copyright Oliver Kowalke 2009. +// 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) + +#include "boost/coroutine/stack_traits.hpp" + +extern "C" { +#include <signal.h> +#include <sys/resource.h> +#include <sys/time.h> +#include <unistd.h> +} + +//#if _POSIX_C_SOURCE >= 200112L + +#include <algorithm> +#include <cmath> + +#include <boost/assert.hpp> +#include <boost/thread.hpp> + +#if !defined (SIGSTKSZ) +# define SIGSTKSZ (8 * 1024) +# define UDEF_SIGSTKSZ +#endif + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif + +namespace { + +void pagesize_( std::size_t * size) +{ + // conform to POSIX.1-2001 + * size = ::sysconf( _SC_PAGESIZE); +} + +void stacksize_limit_( rlimit * limit) +{ + // conforming to POSIX.1-2001 +#if defined(BOOST_DISABLE_ASSERTS) || defined(NDEBUG) + ::getrlimit( RLIMIT_STACK, limit); +#else + const int result = ::getrlimit( RLIMIT_STACK, limit); + BOOST_ASSERT( 0 == result); +#endif +} + +std::size_t pagesize() +{ + static std::size_t size = 0; + static boost::once_flag flag; + boost::call_once( flag, pagesize_, & size); + return size; +} + +rlimit stacksize_limit() +{ + static rlimit limit; + static boost::once_flag flag; + boost::call_once( flag, stacksize_limit_, & limit); + return limit; +} + +} + +namespace boost { +namespace coroutines { + +bool +stack_traits::is_unbounded() BOOST_NOEXCEPT +{ return RLIM_INFINITY == stacksize_limit().rlim_max; } + +std::size_t +stack_traits::page_size() BOOST_NOEXCEPT +{ return pagesize(); } + +std::size_t +stack_traits::default_size() BOOST_NOEXCEPT +{ + std::size_t size = 8 * minimum_size(); + if ( is_unbounded() ) return size; + + BOOST_ASSERT( maximum_size() >= minimum_size() ); + return maximum_size() == size + ? size + : (std::min)( size, maximum_size() ); +} + +std::size_t +stack_traits::minimum_size() BOOST_NOEXCEPT +{ return SIGSTKSZ; } + +std::size_t +stack_traits::maximum_size() BOOST_NOEXCEPT +{ + BOOST_ASSERT( ! is_unbounded() ); + return static_cast< std::size_t >( stacksize_limit().rlim_max); +} + +}} + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif + +#ifdef UDEF_SIGSTKSZ +# undef SIGSTKSZ +#endif diff --git a/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp index db4522fecee..bdf417a7453 100644 --- a/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp +++ b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp @@ -1,114 +1,114 @@ - -// Copyright Oliver Kowalke 2009. -// 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) - -#include "boost/coroutine/stack_traits.hpp" - -extern "C" { -#include <windows.h> -} - -//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L - -#include <algorithm> -#include <cmath> -#include <cstddef> -#include <cstring> -#include <stdexcept> - -#include <boost/assert.hpp> -#include <boost/coroutine/detail/config.hpp> -#include <boost/thread.hpp> - -#include <boost/coroutine/stack_context.hpp> - -// x86_64 -// test x86_64 before i386 because icc might -// define __i686__ for x86_64 too -#if defined(__x86_64__) || defined(__x86_64) \ - || defined(__amd64__) || defined(__amd64) \ - || defined(_M_X64) || defined(_M_AMD64) - -// Windows seams not to provide a constant or function -// telling the minimal stacksize -# define MIN_STACKSIZE 8 * 1024 -#else -# define MIN_STACKSIZE 4 * 1024 -#endif - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_PREFIX -#endif - -namespace { - -void system_info_( SYSTEM_INFO * si) -{ ::GetSystemInfo( si); } - -SYSTEM_INFO system_info() -{ - static SYSTEM_INFO si; - static boost::once_flag flag; - boost::call_once( flag, static_cast< void(*)( SYSTEM_INFO *) >( system_info_), & si); - return si; -} - -std::size_t pagesize() -{ return static_cast< std::size_t >( system_info().dwPageSize); } - -std::size_t page_count( std::size_t stacksize) -{ - return static_cast< std::size_t >( - std::floor( - static_cast< float >( stacksize) / pagesize() ) ); -} - -} - -namespace boost { -namespace coroutines { - -// Windows seams not to provide a limit for the stacksize -// libcoco uses 32k+4k bytes as minimum -bool -stack_traits::is_unbounded() BOOST_NOEXCEPT -{ return true; } - -std::size_t -stack_traits::page_size() BOOST_NOEXCEPT -{ return pagesize(); } - -std::size_t -stack_traits::default_size() BOOST_NOEXCEPT -{ - std::size_t size = 64 * 1024; // 64 kB - if ( is_unbounded() ) - return (std::max)( size, minimum_size() ); - - BOOST_ASSERT( maximum_size() >= minimum_size() ); - return maximum_size() == minimum_size() - ? minimum_size() - : ( std::min)( size, maximum_size() ); -} - -// because Windows seams not to provide a limit for minimum stacksize -std::size_t -stack_traits::minimum_size() BOOST_NOEXCEPT -{ return MIN_STACKSIZE; } - -// because Windows seams not to provide a limit for maximum stacksize -// maximum_size() can never be called (pre-condition ! is_unbounded() ) -std::size_t -stack_traits::maximum_size() BOOST_NOEXCEPT -{ - BOOST_ASSERT( ! is_unbounded() ); - return 1 * 1024 * 1024 * 1024; // 1GB -} - -}} - -#ifdef BOOST_HAS_ABI_HEADERS -# include BOOST_ABI_SUFFIX -#endif + +// Copyright Oliver Kowalke 2009. +// 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) + +#include "boost/coroutine/stack_traits.hpp" + +extern "C" { +#include <windows.h> +} + +//#if defined (BOOST_WINDOWS) || _POSIX_C_SOURCE >= 200112L + +#include <algorithm> +#include <cmath> +#include <cstddef> +#include <cstring> +#include <stdexcept> + +#include <boost/assert.hpp> +#include <boost/coroutine/detail/config.hpp> +#include <boost/thread.hpp> + +#include <boost/coroutine/stack_context.hpp> + +// x86_64 +// test x86_64 before i386 because icc might +// define __i686__ for x86_64 too +#if defined(__x86_64__) || defined(__x86_64) \ + || defined(__amd64__) || defined(__amd64) \ + || defined(_M_X64) || defined(_M_AMD64) + +// Windows seams not to provide a constant or function +// telling the minimal stacksize +# define MIN_STACKSIZE 8 * 1024 +#else +# define MIN_STACKSIZE 4 * 1024 +#endif + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_PREFIX +#endif + +namespace { + +void system_info_( SYSTEM_INFO * si) +{ ::GetSystemInfo( si); } + +SYSTEM_INFO system_info() +{ + static SYSTEM_INFO si; + static boost::once_flag flag; + boost::call_once( flag, static_cast< void(*)( SYSTEM_INFO *) >( system_info_), & si); + return si; +} + +std::size_t pagesize() +{ return static_cast< std::size_t >( system_info().dwPageSize); } + +std::size_t page_count( std::size_t stacksize) +{ + return static_cast< std::size_t >( + std::floor( + static_cast< float >( stacksize) / pagesize() ) ); +} + +} + +namespace boost { +namespace coroutines { + +// Windows seams not to provide a limit for the stacksize +// libcoco uses 32k+4k bytes as minimum +bool +stack_traits::is_unbounded() BOOST_NOEXCEPT +{ return true; } + +std::size_t +stack_traits::page_size() BOOST_NOEXCEPT +{ return pagesize(); } + +std::size_t +stack_traits::default_size() BOOST_NOEXCEPT +{ + std::size_t size = 64 * 1024; // 64 kB + if ( is_unbounded() ) + return (std::max)( size, minimum_size() ); + + BOOST_ASSERT( maximum_size() >= minimum_size() ); + return maximum_size() == minimum_size() + ? minimum_size() + : ( std::min)( size, maximum_size() ); +} + +// because Windows seams not to provide a limit for minimum stacksize +std::size_t +stack_traits::minimum_size() BOOST_NOEXCEPT +{ return MIN_STACKSIZE; } + +// because Windows seams not to provide a limit for maximum stacksize +// maximum_size() can never be called (pre-condition ! is_unbounded() ) +std::size_t +stack_traits::maximum_size() BOOST_NOEXCEPT +{ + BOOST_ASSERT( ! is_unbounded() ); + return 1 * 1024 * 1024 * 1024; // 1GB +} + +}} + +#ifdef BOOST_HAS_ABI_HEADERS +# include BOOST_ABI_SUFFIX +#endif |
