2 // Copyright Oliver Kowalke 2014.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at
5 // http://www.boost.org/LICENSE_1_0.txt)
11 #include <boost/config.hpp>
13 #include <boost/context/all.hpp>
15 #ifdef BOOST_MSVC //MS VisualStudio
16 __declspec(noinline) void access( char *buf);
18 void access( char *buf) __attribute__ ((noinline));
20 void access( char *buf) {
28 std::cout << i << ". iteration" << std::endl;
35 #if defined(BOOST_USE_SEGMENTED_STACKS)
36 std::cout << "using segmented_stack stacks: allocates " << count << " * 4kB == " << 4 * count << "kB on stack, ";
37 std::cout << "initial stack size = " << boost::context::segmented_stack::traits_type::default_size() / 1024 << "kB" << std::endl;
38 std::cout << "application should not fail" << std::endl;
40 std::cout << "using standard stacks: allocates " << count << " * 4kB == " << 4 * count << "kB on stack, ";
41 std::cout << "initial stack size = " << boost::context::fixedsize_stack::traits_type::default_size() / 1024 << "kB" << std::endl;
42 std::cout << "application might fail" << std::endl;
44 boost::context::execution_context main_ctx(
45 boost::context::execution_context::current() );
46 boost::context::execution_context bar_ctx(
47 [& main_ctx, count]( void *){
52 std::cout << "main: done" << std::endl;