Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:28:41

0001 //
0002 // detail/local_free_on_block_exit.hpp
0003 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0004 //
0005 // Copyright (c) 2003-2023 Christopher M. Kohlhoff (chris at kohlhoff dot com)
0006 //
0007 // Distributed under the Boost Software License, Version 1.0. (See accompanying
0008 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
0009 //
0010 
0011 #ifndef BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
0012 #define BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP
0013 
0014 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
0015 # pragma once
0016 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
0017 
0018 #include <boost/asio/detail/config.hpp>
0019 
0020 #if defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0021 #if !defined(BOOST_ASIO_WINDOWS_APP)
0022 
0023 #include <boost/asio/detail/noncopyable.hpp>
0024 #include <boost/asio/detail/socket_types.hpp>
0025 
0026 #include <boost/asio/detail/push_options.hpp>
0027 
0028 namespace boost {
0029 namespace asio {
0030 namespace detail {
0031 
0032 class local_free_on_block_exit
0033   : private noncopyable
0034 {
0035 public:
0036   // Constructor blocks all signals for the calling thread.
0037   explicit local_free_on_block_exit(void* p)
0038     : p_(p)
0039   {
0040   }
0041 
0042   // Destructor restores the previous signal mask.
0043   ~local_free_on_block_exit()
0044   {
0045     ::LocalFree(p_);
0046   }
0047 
0048 private:
0049   void* p_;
0050 };
0051 
0052 } // namespace detail
0053 } // namespace asio
0054 } // namespace boost
0055 
0056 #include <boost/asio/detail/pop_options.hpp>
0057 
0058 #endif // !defined(BOOST_ASIO_WINDOWS_APP)
0059 #endif // defined(BOOST_ASIO_WINDOWS) || defined(__CYGWIN__)
0060 
0061 #endif // BOOST_ASIO_DETAIL_LOCAL_FREE_ON_BLOCK_EXIT_HPP