thread.hpp 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. //
  2. // detail/thread.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2018 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_WINDOWS)
  19. # if defined(UNDER_CE)
  20. # include <boost/asio/detail/wince_thread.hpp>
  21. # elif defined(BOOST_ASIO_WINDOWS_APP)
  22. # include <boost/asio/detail/winapp_thread.hpp>
  23. # else
  24. # include <boost/asio/detail/win_thread.hpp>
  25. # endif
  26. #elif defined(BOOST_ASIO_HAS_PTHREADS)
  27. # include <boost/asio/detail/posix_thread.hpp>
  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_WINDOWS)
  39. # if defined(UNDER_CE)
  40. typedef wince_thread thread;
  41. # elif defined(BOOST_ASIO_WINDOWS_APP)
  42. typedef winapp_thread thread;
  43. # else
  44. typedef win_thread thread;
  45. # endif
  46. #elif defined(BOOST_ASIO_HAS_PTHREADS)
  47. typedef posix_thread thread;
  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