thread.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // detail/thread.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_THREAD_HPP
  11. #define BOOST_ASIO_DETAIL_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/config.hpp>
  16. #if !defined(BOOST_ASIO_HAS_THREADS)
  17. # include <boost/asio/detail/null_thread.hpp>
  18. #elif defined(BOOST_ASIO_HAS_PTHREADS)
  19. # include <boost/asio/detail/posix_thread.hpp>
  20. #elif defined(BOOST_ASIO_WINDOWS)
  21. # if defined(UNDER_CE)
  22. # include <boost/asio/detail/wince_thread.hpp>
  23. # elif defined(BOOST_ASIO_WINDOWS_APP)
  24. # include <boost/asio/detail/winapp_thread.hpp>
  25. # else
  26. # include <boost/asio/detail/win_thread.hpp>
  27. # endif
  28. #elif defined(BOOST_ASIO_HAS_STD_THREAD)
  29. # include <boost/asio/detail/std_thread.hpp>
  30. #else
  31. # error Only Windows, POSIX and std::thread are supported!
  32. #endif
  33. namespace boost {
  34. namespace asio {
  35. namespace detail {
  36. #if !defined(BOOST_ASIO_HAS_THREADS)
  37. typedef null_thread thread;
  38. #elif defined(BOOST_ASIO_HAS_PTHREADS)
  39. typedef posix_thread thread;
  40. #elif defined(BOOST_ASIO_WINDOWS)
  41. # if defined(UNDER_CE)
  42. typedef wince_thread thread;
  43. # elif defined(BOOST_ASIO_WINDOWS_APP)
  44. typedef winapp_thread thread;
  45. # else
  46. typedef win_thread thread;
  47. # endif
  48. #elif defined(BOOST_ASIO_HAS_STD_THREAD)
  49. typedef std_thread thread;
  50. #endif
  51. } // namespace detail
  52. } // namespace asio
  53. } // namespace boost
  54. #endif // BOOST_ASIO_DETAIL_THREAD_HPP