null_signal_blocker.hpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //
  2. // null_signal_blocker.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2010 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 ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP
  11. #define 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 "asio/detail/push_options.hpp"
  16. #include "asio/detail/push_options.hpp"
  17. #include <boost/config.hpp>
  18. #include "asio/detail/pop_options.hpp"
  19. #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
  20. #include "asio/detail/noncopyable.hpp"
  21. namespace asio {
  22. namespace detail {
  23. class null_signal_blocker
  24. : private noncopyable
  25. {
  26. public:
  27. // Constructor blocks all signals for the calling thread.
  28. null_signal_blocker()
  29. {
  30. }
  31. // Destructor restores the previous signal mask.
  32. ~null_signal_blocker()
  33. {
  34. }
  35. // Block all signals for the calling thread.
  36. void block()
  37. {
  38. }
  39. // Restore the previous signal mask.
  40. void unblock()
  41. {
  42. }
  43. };
  44. } // namespace detail
  45. } // namespace asio
  46. #endif // !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
  47. #include "asio/detail/pop_options.hpp"
  48. #endif // ASIO_DETAIL_NULL_SIGNAL_BLOCKER_HPP