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)
10 #include <boost/context/execution_context.hpp>
12 namespace ctx = boost::context;
14 ctx::execution_context< int > f1( ctx::execution_context< int > && ctxm, int data) {
15 std::cout << "f1: entered first time: " << data << std::endl;
16 std::tie( ctxm, data) = ctxm( data + 2);
17 std::cout << "f1: entered second time: " << data << std::endl;
18 return std::move( ctxm);
23 ctx::execution_context< int > ctx1( f1);
24 std::tie( ctx1, data) = ctx1( data + 2);
25 std::cout << "f1: returned first time: " << data << std::endl;
26 std::tie( ctx1, data) = ctx1( data + 2);
27 std::cout << "f1: returned second time: " << data << std::endl;
29 std::cout << "main: done" << std::endl;