]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/example/thread_guard.cpp
1 // (C) Copyright 2009-2012 Anthony Williams
2 // (C) Copyright 2012 Vicente Botet
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
10 #include <boost/thread/thread_only.hpp>
11 #include <boost/thread/thread_guard.hpp>
13 void do_something(int& i
)
23 func(func
const& other
):i(other
.i
){}
27 for(unsigned j
=0;j
<1000000;++j
)
34 func
& operator=(func
const&);
38 void do_something_in_current_thread()
45 func
my_func(some_local_state
);
46 boost::thread
t(my_func
);
47 boost::thread_guard
<> g(t
);
49 do_something_in_current_thread();