signal_blocker.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. //
  2. // 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_SIGNAL_BLOCKER_HPP
  11. #define ASIO_DETAIL_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/null_signal_blocker.hpp"
  21. #elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  22. # include "asio/detail/win_signal_blocker.hpp"
  23. #elif defined(BOOST_HAS_PTHREADS)
  24. # include "asio/detail/posix_signal_blocker.hpp"
  25. #else
  26. # error Only Windows and POSIX are supported!
  27. #endif
  28. namespace asio {
  29. namespace detail {
  30. #if !defined(BOOST_HAS_THREADS) || defined(ASIO_DISABLE_THREADS)
  31. typedef null_signal_blocker signal_blocker;
  32. #elif defined(BOOST_WINDOWS) || defined(__CYGWIN__)
  33. typedef win_signal_blocker signal_blocker;
  34. #elif defined(BOOST_HAS_PTHREADS)
  35. typedef posix_signal_blocker signal_blocker;
  36. #endif
  37. } // namespace detail
  38. } // namespace asio
  39. #include "asio/detail/pop_options.hpp"
  40. #endif // ASIO_DETAIL_SIGNAL_BLOCKER_HPP