]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/endless_loop.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / context / example / endless_loop.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
10 #include <boost/context/continuation.hpp>
11
12 namespace ctx = boost::context;
13
14 ctx::continuation foo( ctx::continuation && c) {
15 do {
16 std::cout << "foo\n";
17 } while ( ( c = c.resume() ) );
18 return std::move( c);
19 }
20
21 int main() {
22 ctx::continuation c = ctx::callcc( foo);
23 do {
24 std::cout << "bar\n";
25 } while ( ( c = c.resume() ) );
26 std::cout << "main: done" << std::endl;
27 return EXIT_SUCCESS;
28 }