]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/context/example/callcc/throw.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)
13 #include <boost/context/continuation.hpp>
15 namespace ctx
= boost::context
;
17 struct my_exception
: public std::runtime_error
{
19 my_exception( ctx::continuation
&& c_
, std::string
const& what
) :
20 std::runtime_error
{ what
},
26 ctx::continuation c
= ctx::callcc([](ctx::continuation
&& c
) {
29 std::cout
<< "entered" << std::endl
;
31 } catch ( my_exception
& ex
) {
32 std::cerr
<< "my_exception: " << ex
.what() << std::endl
;
33 return std::move( ex
.c
);
39 [](ctx::continuation
&& c
){
40 throw my_exception(std::move( c
), "abc");
44 std::cout
<< "main: done" << std::endl
;