platform.hpp 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // Copyright 2006 Roland Schwarz.
  2. // (C) Copyright 2007 Anthony Williams
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. //
  7. // This work is a reimplementation along the design and ideas
  8. // of William E. Kempf.
  9. #ifndef BOOST_THREAD_RS06040501_HPP
  10. #define BOOST_THREAD_RS06040501_HPP
  11. // fetch compiler and platform configuration
  12. #include <boost/config.hpp>
  13. // insist on threading support being available:
  14. #include <boost/config/requires_threads.hpp>
  15. // choose platform
  16. #if defined(linux) || defined(__linux) || defined(__linux__)
  17. # define BOOST_THREAD_LINUX
  18. //# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000)
  19. #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
  20. # define BOOST_THREAD_BSD
  21. #elif defined(sun) || defined(__sun)
  22. # define BOOST_THREAD_SOLARIS
  23. #elif defined(__sgi)
  24. # define BOOST_THREAD_IRIX
  25. #elif defined(__hpux)
  26. # define BOOST_THREAD_HPUX
  27. #elif defined(__CYGWIN__)
  28. # define BOOST_THREAD_CYGWIN
  29. #elif (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(BOOST_DISABLE_WIN32)
  30. # define BOOST_THREAD_WIN32
  31. #elif defined(__BEOS__)
  32. # define BOOST_THREAD_BEOS
  33. #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  34. # define BOOST_THREAD_MACOS
  35. //# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000)
  36. #elif defined(__IBMCPP__) || defined(_AIX)
  37. # define BOOST_THREAD_AIX
  38. #elif defined(__amigaos__)
  39. # define BOOST_THREAD_AMIGAOS
  40. #elif defined(__QNXNTO__)
  41. # define BOOST_THREAD_QNXNTO
  42. #elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE)
  43. # if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_THREAD_POSIX)
  44. # define BOOST_THREAD_POSIX
  45. # endif
  46. #endif
  47. // For every supported platform add a new entry into the dispatch table below.
  48. // BOOST_THREAD_POSIX is tested first, so on platforms where posix and native
  49. // threading is available, the user may choose, by defining BOOST_THREAD_POSIX
  50. // in her source. If a platform is known to support pthreads and no native
  51. // port of boost_thread is available just specify "pthread" in the
  52. // dispatcher table. If there is no entry for a platform but pthreads is
  53. // available on the platform, pthread is choosen as default. If nothing is
  54. // available the preprocessor will fail with a diagnostic message.
  55. #if defined(BOOST_THREAD_POSIX)
  56. # define BOOST_THREAD_PLATFORM_PTHREAD
  57. #else
  58. # if defined(BOOST_THREAD_WIN32)
  59. # define BOOST_THREAD_PLATFORM_WIN32
  60. # elif defined(BOOST_HAS_PTHREADS)
  61. # define BOOST_THREAD_PLATFORM_PTHREAD
  62. # else
  63. # error "Sorry, no boost threads are available for this platform."
  64. # endif
  65. #endif
  66. #endif // BOOST_THREAD_RS06040501_HPP