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