]>
Commit | Line | Data |
---|---|---|
7c673cae | 1 | |
11fdf7f2 | 2 | // Copyright Oliver Kowalke 2014. |
7c673cae FG |
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) | |
6 | ||
7 | #include <cstdlib> | |
8 | #include <iostream> | |
9 | ||
11fdf7f2 | 10 | #include <boost/context/all.hpp> |
7c673cae FG |
11 | |
12 | namespace ctx = boost::context; | |
13 | ||
11fdf7f2 | 14 | ctx::execution_context< void > f1( ctx::execution_context< void > && ctxm) { |
7c673cae | 15 | std::cout << "f1: entered first time" << std::endl; |
11fdf7f2 | 16 | ctxm = ctxm(); |
7c673cae | 17 | std::cout << "f1: entered second time" << std::endl; |
11fdf7f2 | 18 | return std::move( ctxm); |
7c673cae FG |
19 | } |
20 | ||
21 | int main() { | |
11fdf7f2 TL |
22 | ctx::execution_context< void > ctx1( f1); |
23 | ctx1 = ctx1(); | |
7c673cae | 24 | std::cout << "f1: returned first time" << std::endl; |
11fdf7f2 | 25 | ctx1 = ctx1(); |
7c673cae | 26 | std::cout << "f1: returned second time" << std::endl; |
11fdf7f2 | 27 | |
7c673cae | 28 | std::cout << "main: done" << std::endl; |
11fdf7f2 | 29 | |
7c673cae FG |
30 | return EXIT_SUCCESS; |
31 | } |