]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/ontop_void.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / example / ontop_void.cpp
1
2 // Copyright Oliver Kowalke 2016.
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 #include <tuple>
10
11 #include <boost/context/continuation.hpp>
12
13 namespace ctx = boost::context;
14
15 ctx::continuation f1( ctx::continuation && c) {
16 std::cout << "f1: entered first time" << std::endl;
17 c = c.resume();
18 std::cout << "f1: entered second time" << std::endl;
19 c = c.resume();
20 std::cout << "f1: entered third time" << std::endl;
21 return std::move( c);
22 }
23
24 ctx::continuation f2( ctx::continuation && c) {
25 std::cout << "f2: entered" << std::endl;
26 return std::move( c);
27 }
28
29 int main() {
30 ctx::continuation c = ctx::callcc( f1);
31 std::cout << "f1: returned first time" << std::endl;
32 c = c.resume();
33 std::cout << "f1: returned second time" << std::endl;
34 c = c.resume_with( f2);
35 std::cout << "f1: returned third time" << std::endl;
36
37 std::cout << "main: done" << std::endl;
38
39 return EXIT_SUCCESS;
40 }