]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/ontop.cpp
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)
11 #include <boost/context/continuation.hpp>
13 namespace ctx
= boost::context
;
17 ctx::continuation c
= ctx::callcc( [&data
](ctx::continuation
&& c
) {
18 std::cout
<< "f1: entered first time: " << data
<< std::endl
;
21 std::cout
<< "f1: entered second time: " << data
<< std::endl
;
24 std::cout
<< "f1: entered third time: " << data
<< std::endl
;
27 std::cout
<< "f1: returned first time: " << data
<< std::endl
;
30 std::cout
<< "f1: returned second time: " << data
<< std::endl
;
32 c
= c
.resume_with( [&data
](ctx::continuation
&& c
){
33 std::cout
<< "f2: entered: " << data
<< std::endl
;
37 std::cout
<< "f1: returned third time" << std::endl
;
38 std::cout
<< "main: done" << std::endl
;