null_signal_blocker.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //
  2. // detail/null_signal_blocker.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2021 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_NULL_SIGNAL_BLOCKER_HPP
  11. #define BOOST_ASIO_DETAIL_NULL_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/config.hpp>
  16. #if !defined(BOOST_ASIO_HAS_THREADS) \
  17. || defined(BOOST_ASIO_WINDOWS) \
  18. || defined(BOOST_ASIO_WINDOWS_RUNTIME) \
  19. || defined(__CYGWIN__) \
  20. || defined(__SYMBIAN32__)
  21. #include <boost/asio/detail/noncopyable.hpp>
  22. #include <boost/asio/detail/push_options.hpp>
  23. namespace boost {
  24. namespace asio {
  25. namespace detail {
  26. class null_signal_blocker
  27. : private noncopyable
  28. {
  29. public:
  30. // Constructor blocks all signals for the calling thread.
  31. null_signal_blocker()
  32. {
  33. }
  34. // Destructor restores the previous signal mask.
  35. ~null_signal_blocker()
  36. {
  37. }
  38. // Block all signals for the calling thread.
  39. void block()
  40. {
  41. }
  42. // Restore the previous signal mask.
  43. void unblock()
  44. {
  45. }
  46. };
  47. } // namespace detail
  48. } // namespace asio
  49. } // namespace boost
  50. #include <boost/asio/detail/pop_options.hpp>
  51. #endif // !defined(BOOST_ASIO_HAS_THREADS)
  52. // || defined(BOOST_ASIO_WINDOWS)
  53. // || defined(BOOST_ASIO_WINDOWS_RUNTIME)
  54. // || defined(__CYGWIN__)
  55. // || defined(__SYMBIAN32__)
  56. #endif // BOOST_ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP