]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/exception/example/cloning_2.cpp
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //This example shows how to transport cloning-enabled boost::exceptions between threads.
8 #include <boost/exception_ptr.hpp>
9 #include <boost/thread.hpp>
10 #include <boost/bind.hpp>
12 void do_work(); //throws cloning-enabled boost::exceptions
15 worker_thread( boost::exception_ptr
& error
)
20 error
= boost::exception_ptr();
25 error
= boost::current_exception();
34 boost::exception_ptr error
;
35 boost::thread
t( boost::bind(worker_thread
,boost::ref(error
)) );
38 boost::rethrow_exception(error
);