]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/example/v2/ontop_void.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / context / example / v2 / ontop_void.cpp
CommitLineData
7c673cae
FG
1
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)
6
7#include <cstdlib>
8#include <iostream>
9#include <tuple>
10
11#include <boost/context/all.hpp>
12
13namespace ctx = boost::context;
14
15ctx::execution_context< void > f1( ctx::execution_context< void > ctx) {
16 std::cout << "f1: entered first time" << std::endl;
17 ctx = ctx();
18 std::cout << "f1: entered second time" << std::endl;
19 ctx = ctx();
20 std::cout << "f1: entered third time" << std::endl;
21 return ctx;
22}
23
24ctx::execution_context< void > f2( ctx::execution_context< void > ctx) {
25 std::cout << "f2: entered" << std::endl;
26 return ctx;
27}
28
29int main() {
30 ctx::execution_context< void > ctx( f1);
31 ctx = ctx();
32 std::cout << "f1: returned first time" << std::endl;
33 ctx = ctx();
34 std::cout << "f1: returned second time" << std::endl;
35 ctx = ctx( ctx::exec_ontop_arg, f2);
36 std::cout << "f1: returned third time" << std::endl;
37
38 std::cout << "main: done" << std::endl;
39
40 return EXIT_SUCCESS;
41}