win_signal_blocker.hpp 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // win_signal_blocker.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2008 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. #ifndef BOOST_ASIO_DETAIL_WIN_SIGNAL_BLOCKER_HPP
  11. #define BOOST_ASIO_DETAIL_WIN_SIGNAL_BLOCKER_HPP
  12. #if defined(_MSC_VER) && (_MSC_VER >= 1200)
  13. # pragma once
  14. #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
  15. #include <boost/asio/detail/push_options.hpp>
  16. #include <boost/asio/detail/push_options.hpp>
  17. #include <boost/config.hpp>
  18. #include <boost/asio/detail/pop_options.hpp>
  19. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  20. #include <boost/asio/detail/noncopyable.hpp>
  21. namespace boost {
  22. namespace asio {
  23. namespace detail {
  24. class win_signal_blocker
  25. : private noncopyable
  26. {
  27. public:
  28. // Constructor blocks all signals for the calling thread.
  29. win_signal_blocker()
  30. {
  31. // No-op.
  32. }
  33. // Destructor restores the previous signal mask.
  34. ~win_signal_blocker()
  35. {
  36. // No-op.
  37. }
  38. // Block all signals for the calling thread.
  39. void block()
  40. {
  41. // No-op.
  42. }
  43. // Restore the previous signal mask.
  44. void unblock()
  45. {
  46. // No-op.
  47. }
  48. };
  49. } // namespace detail
  50. } // namespace asio
  51. } // namespace boost
  52. #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  53. #include <boost/asio/detail/pop_options.hpp>
  54. #endif // BOOST_ASIO_DETAIL_WIN_SIGNAL_BLOCKER_HPP