]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/v1/ontop.cpp
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/all.hpp>
12 boost::context::execution_context
* ctx1
= nullptr;
13 boost::context::execution_context
* ctx
= nullptr;
16 std::cout
<< "f1: entered first time" << std::endl
;
18 std::cout
<< "f1: entered second time" << std::endl
;
20 std::cout
<< "f1: entered third time" << std::endl
;
24 void * f2( void * data
) {
25 std::cout
<< "f2: entered" << std::endl
;
30 boost::context::execution_context
ctx1_( f1
);
32 boost::context::execution_context
ctx_( boost::context::execution_context::current() );
36 std::cout
<< "f1: returned first time" << std::endl
;
38 std::cout
<< "f1: returned second time" << std::endl
;
39 ( * ctx1
)( boost::context::exec_ontop_arg
, f2
);
40 std::cout
<< "f1: returned third time" << std::endl
;
42 std::cout
<< "main: done" << std::endl
;