Realistic 3D camera system
3D camera system components
local_free_on_block_exit.hpp
Go to the documentation of this file.
1 //
2 // detail/local_free_on_block_exit.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2015 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
12 #define ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
13 
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
15 # pragma once
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
17 
18 #include "asio/detail/config.hpp"
19 
20 #if defined(ASIO_WINDOWS) || defined(__CYGWIN__)
21 
24 
26 
27 namespace asio {
28 namespace detail {
29 
30 class local_free_on_block_exit
31  : private noncopyable
32 {
33 public:
34  // Constructor blocks all signals for the calling thread.
35  explicit local_free_on_block_exit(void* p)
36  : p_(p)
37  {
38  }
39 
40  // Destructor restores the previous signal mask.
41  ~local_free_on_block_exit()
42  {
43  ::LocalFree(p_);
44  }
45 
46 private:
47  void* p_;
48 };
49 
50 } // namespace detail
51 } // namespace asio
52 
54 
55 #endif // defined(ASIO_WINDOWS) || defined(__CYGWIN__)
56 
57 #endif // ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP