| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

scope_guard.hpp
Go to the documentation of this file.
1
17 #ifndef THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED
18 #define THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED
19
20
21
22 #include <boost/function.hpp>
23
24
25 namespace boost { namespace threadpool { namespace detail
26 {
27
28 // TODO documentation
29 class scope_guard
30 : private boost::noncopyable
31 {
32 function0<void> const m_function;
33 bool m_is_active;
34
35 public:
36 scope_guard(function0<void> const & call_on_exit)
37 : m_function(call_on_exit)
38 , m_is_active(true)
39 {
40 }
41
42 ~scope_guard()
43 {
44 if(m_is_active && m_function)
45 {
46 m_function();
47 }
48 }
49
50 void disable()
51 {
52 m_is_active = false;
53 }
54 };
55
56
57
58
59
60
61 } } } // namespace boost::threadpool::detail
62
63 #endif // THREADPOOL_DETAIL_SCOPE_GUARD_HPP_INCLUDED
64
65
boost::threadpool::detail::scope_guard::m_function
function0< void > const m_function
Definition: scope_guard.hpp:32
boost
The namespace threadpool contains a thread pool and related utility classes.
Definition: iter_pos.hpp:13
boost::threadpool::detail::scope_guard::scope_guard
scope_guard(function0< void > const &call_on_exit)
Definition: scope_guard.hpp:36
detail
TupleObj.h GaudiAlg/TupleObj.h namespace with few technical implementations.
boost::threadpool::detail::scope_guard::disable
void disable()
Definition: scope_guard.hpp:50
boost::threadpool::detail::scope_guard
Definition: scope_guard.hpp:29
boost::threadpool::detail::scope_guard::~scope_guard
~scope_guard()
Definition: scope_guard.hpp:42
boost::threadpool::detail::scope_guard::m_is_active
bool m_is_active
Definition: scope_guard.hpp:33