]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/context/example/v1/jump.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / context / example / v1 / jump.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
10#include <boost/context/all.hpp>
11
12boost::context::execution_context * ctx1 = nullptr;
13boost::context::execution_context * ctx2 = nullptr;
14boost::context::execution_context * ctx = nullptr;
15
16void f1( int i, void *) {
17 std::cout << "f1: entered" << std::endl;
18 std::cout << "i == " << i << std::endl;
19 ( * ctx2)();
20 std::cout << "f1: re-entered" << std::endl;
21 ( * ctx2)();
22}
23
24void f2( void *) {
25 std::cout << "f2: entered" << std::endl;
26 ( * ctx1)();
27 std::cout << "f2: re-entered" << std::endl;
28 ( * ctx)();
29}
30
31int main() {
32 {
33 boost::context::execution_context ctx1_( f1, 3);
34 ctx1 = & ctx1_;
35 boost::context::execution_context ctx2_( f2);
36 ctx2 = & ctx2_;
37 boost::context::execution_context ctx_( boost::context::execution_context::current() );
38 ctx = & ctx_;
39
40 ( * ctx1)();
41 }
42 std::cout << "main: done" << std::endl;
43 return EXIT_SUCCESS;
44}