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
30 : private boost::noncopyable
31 {
32  function0<void> const m_function;
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 
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 
function0< void > const m_function
Definition: scope_guard.hpp:32
The namespace threadpool contains a thread pool and related utility classes.
scope_guard(function0< void > const &call_on_exit)
Definition: scope_guard.hpp:36


asr_descriptor_surface_based_recognition
Author(s): Allgeyer Tobias, Hutmacher Robin, Meißner Pascal
autogenerated on Mon Dec 16 2019 03:31:15