platform.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. #if ! defined BOOST_THREAD_WIN32
  31. # define BOOST_THREAD_WIN32
  32. #endif
  33. #elif defined(__BEOS__)
  34. # define BOOST_THREAD_BEOS
  35. #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  36. # define BOOST_THREAD_MACOS
  37. //# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000)
  38. #elif defined(__IBMCPP__) || defined(_AIX)
  39. # define BOOST_THREAD_AIX
  40. #elif defined(__amigaos__)
  41. # define BOOST_THREAD_AMIGAOS
  42. #elif defined(__QNXNTO__)
  43. # define BOOST_THREAD_QNXNTO
  44. #elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE)
  45. # if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_THREAD_POSIX)
  46. # define BOOST_THREAD_POSIX
  47. # endif
  48. #endif
  49. // For every supported platform add a new entry into the dispatch table below.
  50. // BOOST_THREAD_POSIX is tested first, so on platforms where posix and native
  51. // threading is available, the user may choose, by defining BOOST_THREAD_POSIX
  52. // in her source. If a platform is known to support pthreads and no native
  53. // port of boost_thread is available just specify "pthread" in the
  54. // dispatcher table. If there is no entry for a platform but pthreads is
  55. // available on the platform, pthread is choosen as default. If nothing is
  56. // available the preprocessor will fail with a diagnostic message.
  57. #if defined(BOOST_THREAD_POSIX)
  58. # define BOOST_THREAD_PLATFORM_PTHREAD
  59. #else
  60. # if defined(BOOST_THREAD_WIN32)
  61. # define BOOST_THREAD_PLATFORM_WIN32
  62. # elif defined(BOOST_HAS_PTHREADS)
  63. # define BOOST_THREAD_PLATFORM_PTHREAD
  64. # else
  65. # error "Sorry, no boost threads are available for this platform."
  66. # endif
  67. #endif
  68. #endif // BOOST_THREAD_RS06040501_HPP