aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/boost/libs/coroutine
diff options
context:
space:
mode:
authorDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
committerDaniil Cherednik <dan.cherednik@gmail.com>2022-09-21 20:17:38 +0300
commite6c9b17192c56494adba359d5e132c431b241191 (patch)
tree6f2449871a118a0e8919ce842b1174e06cb470ef /contrib/restricted/boost/libs/coroutine
parent285021ab1aac39e84b269d9bacd4deee69cf63fc (diff)
downloadydb-e6c9b17192c56494adba359d5e132c431b241191.tar.gz
Ydb stable 22-4-2122.4.21
x-stable-origin-commit: e89099581237299a132feafb5b58af59ebd0468a
Diffstat (limited to 'contrib/restricted/boost/libs/coroutine')
-rw-r--r--contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt36
-rw-r--r--contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp114
2 files changed, 150 insertions, 0 deletions
diff --git a/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt b/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt
new file mode 100644
index 0000000000..e36f8b9042
--- /dev/null
+++ b/contrib/restricted/boost/libs/coroutine/.yandex_meta/licenses.list.txt
@@ -0,0 +1,36 @@
+====================BSL-1.0====================
+// 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)
+
+
+====================COPYRIGHT====================
+// Copyright Oliver Kowalke 2009.
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+
+
+====================File: LICENSE_1_0.txt====================
+Boost Software License - Version 1.0 - August 17th, 2003
+
+Permission is hereby granted, free of charge, to any person or organization
+obtaining a copy of the software and accompanying documentation covered by
+this license (the "Software") to use, reproduce, display, distribute,
+execute, and transmit the Software, and to prepare derivative works of the
+Software, and to permit third-parties to whom the Software is furnished to
+do so, all subject to the following:
+
+The copyright notices in the Software and this entire statement, including
+the above license grant, this restriction and the following disclaimer,
+must be included in all copies of the Software, in whole or in part, and
+all derivative works of the Software, unless such copies or derivative
+works are solely in the form of machine-executable object code generated by
+a source language processor.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
+SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
+FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp
new file mode 100644
index 0000000000..bdf417a745
--- /dev/null
+++ b/contrib/restricted/boost/libs/coroutine/src/windows/stack_traits.cpp
@@ -0,0 +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