thread.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // detail/thread.hpp
  3. // ~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 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_THREAD_HPP
  11. #define 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 "asio/detail/config.hpp"
  16. #if !defined(ASIO_HAS_THREADS)
  17. # include "asio/detail/null_thread.hpp"
  18. #elif defined(ASIO_WINDOWS)
  19. # if defined(UNDER_CE)
  20. # include "asio/detail/wince_thread.hpp"
  21. # else
  22. # include "asio/detail/win_thread.hpp"
  23. # endif
  24. #elif defined(ASIO_HAS_PTHREADS)
  25. # include "asio/detail/posix_thread.hpp"
  26. #elif defined(ASIO_HAS_STD_THREAD)
  27. # include "asio/detail/std_thread.hpp"
  28. #else
  29. # error Only Windows, POSIX and std::thread are supported!
  30. #endif
  31. namespace asio {
  32. namespace detail {
  33. #if !defined(ASIO_HAS_THREADS)
  34. typedef null_thread thread;
  35. #elif defined(ASIO_WINDOWS)
  36. # if defined(UNDER_CE)
  37. typedef wince_thread thread;
  38. # else
  39. typedef win_thread thread;
  40. # endif
  41. #elif defined(ASIO_HAS_PTHREADS)
  42. typedef posix_thread thread;
  43. #elif defined(ASIO_HAS_STD_THREAD)
  44. typedef std_thread thread;
  45. #endif
  46. } // namespace detail
  47. } // namespace asio
  48. #endif // ASIO_DETAIL_THREAD_HPP