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
10#ifndef BOOST_THREAD_RS06040501_HPP
11#define BOOST_THREAD_RS06040501_HPP
12
13// fetch compiler and platform configuration
14#include <boost/config.hpp>
15
16// insist on threading support being available:
17#include <boost/config/requires_threads.hpp>
18
19// choose platform
20#if defined(linux) || defined(__linux) || defined(__linux__)
21# define BOOST_THREAD_LINUX
22//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000)
23#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)
24# define BOOST_THREAD_BSD
25#elif defined(sun) || defined(__sun)
26# define BOOST_THREAD_SOLARIS
27#elif defined(__sgi)
28# define BOOST_THREAD_IRIX
29#elif defined(__hpux)
30# define BOOST_THREAD_HPUX
31#elif defined(__CYGWIN__)
32# define BOOST_THREAD_CYGWIN
33#elif (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(BOOST_DISABLE_WIN32)
34#if ! defined BOOST_THREAD_WIN32
35# define BOOST_THREAD_WIN32
36#endif
37#elif defined(__BEOS__)
38# define BOOST_THREAD_BEOS
39#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
40# define BOOST_THREAD_MACOS
41//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000)
42#elif defined(__IBMCPP__) || defined(_AIX)
43# define BOOST_THREAD_AIX
44#elif defined(__amigaos__)
45# define BOOST_THREAD_AMIGAOS
46#elif defined(__QNXNTO__)
47# define BOOST_THREAD_QNXNTO
48#elif defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE)
49# if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_THREAD_POSIX)
50# define BOOST_THREAD_POSIX
51# endif
52#endif
53
54// For every supported platform add a new entry into the dispatch table below.
55// BOOST_THREAD_POSIX is tested first, so on platforms where posix and native
56// threading is available, the user may choose, by defining BOOST_THREAD_POSIX
57// in her source. If a platform is known to support pthreads and no native
58// port of boost_thread is available just specify "pthread" in the
59// dispatcher table. If there is no entry for a platform but pthreads is
60// available on the platform, pthread is choosen as default. If nothing is
61// available the preprocessor will fail with a diagnostic message.
62
63#if defined(BOOST_THREAD_POSIX)
64# define BOOST_THREAD_PLATFORM_PTHREAD
65#else
66# if defined(BOOST_THREAD_WIN32)
67# define BOOST_THREAD_PLATFORM_WIN32
68# elif defined(BOOST_HAS_PTHREADS)
69# define BOOST_THREAD_PLATFORM_PTHREAD
70# else
71# error "Sorry, no boost threads are available for this platform."
72# endif
73#endif
74
75#endif // BOOST_THREAD_RS06040501_HPP
76

source code of boost/libs/thread/include/boost/thread/detail/platform.hpp