null_thread.hpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // null_thread.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_NULL_THREAD_HPP
  11. #define BOOST_ASIO_DETAIL_NULL_THREAD_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/system/system_error.hpp>
  19. #include <boost/asio/detail/pop_options.hpp>
  20. #if !defined(BOOST_HAS_THREADS)
  21. #include <boost/asio/detail/push_options.hpp>
  22. #include <boost/throw_exception.hpp>
  23. #include <boost/asio/detail/pop_options.hpp>
  24. #include <boost/asio/error.hpp>
  25. #include <boost/asio/detail/noncopyable.hpp>
  26. namespace boost {
  27. namespace asio {
  28. namespace detail {
  29. class null_thread
  30. : private noncopyable
  31. {
  32. public:
  33. // Constructor.
  34. template <typename Function>
  35. null_thread(Function f)
  36. {
  37. boost::system::system_error e(
  38. boost::asio::error::operation_not_supported, "thread");
  39. boost::throw_exception(e);
  40. }
  41. // Destructor.
  42. ~null_thread()
  43. {
  44. }
  45. // Wait for the thread to exit.
  46. void join()
  47. {
  48. }
  49. };
  50. } // namespace detail
  51. } // namespace asio
  52. } // namespace boost
  53. #endif // !defined(BOOST_HAS_THREADS)
  54. #include <boost/asio/detail/pop_options.hpp>
  55. #endif // BOOST_ASIO_DETAIL_NULL_THREAD_HPP