Imported Upstream version 1.64.0
[platform/upstream/boost.git] / boost / fiber / detail / config.hpp
1
2 //          Copyright Oliver Kowalke 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 //    (See accompanying file LICENSE_1_0.txt or copy at
5 //          http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_FIBERS_DETAIL_CONFIG_H
8 #define BOOST_FIBERS_DETAIL_CONFIG_H
9
10 #include <cstddef>
11
12 #include <boost/config.hpp>
13 #include <boost/predef.h> 
14 #include <boost/detail/workaround.hpp>
15
16 #ifdef BOOST_FIBERS_DECL
17 # undef BOOST_FIBERS_DECL
18 #endif
19
20 #if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FIBERS_DYN_LINK) ) && ! defined(BOOST_FIBERS_STATIC_LINK)
21 # if defined(BOOST_FIBERS_SOURCE)
22 #  define BOOST_FIBERS_DECL BOOST_SYMBOL_EXPORT
23 #  define BOOST_FIBERS_BUILD_DLL
24 # else
25 #  define BOOST_FIBERS_DECL BOOST_SYMBOL_IMPORT
26 # endif
27 #endif
28
29 #if ! defined(BOOST_FIBERS_DECL)
30 # define BOOST_FIBERS_DECL
31 #endif
32
33 #if ! defined(BOOST_FIBERS_SOURCE) && ! defined(BOOST_ALL_NO_LIB) && ! defined(BOOST_FIBERS_NO_LIB)
34 # define BOOST_LIB_NAME boost_fiber
35 # if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FIBERS_DYN_LINK)
36 #  define BOOST_DYN_LINK
37 # endif
38 # include <boost/config/auto_link.hpp>
39 #endif
40
41 #if BOOST_OS_LINUX || BOOST_OS_WINDOWS
42 # define BOOST_FIBERS_HAS_FUTEX
43 #endif
44
45 #if (!defined(BOOST_FIBERS_HAS_FUTEX) && \
46     (defined(BOOST_FIBERS_SPINLOCK_TTAS_FUTEX) || defined(BOOST_FIBERS_SPINLOCK_TTAS_ADAPTIVE_FUTEX)))
47 # error "futex not supported on this platform"
48 #endif
49
50 #if !defined(BOOST_FIBERS_SPIN_MAX_COLLISIONS)
51 # define BOOST_FIBERS_SPIN_MAX_COLLISIONS 16
52 #endif
53
54 #if !defined(BOOST_FIBERS_SPIN_MAX_TESTS)
55 # define BOOST_FIBERS_SPIN_MAX_TESTS 500
56 #endif
57
58 // modern architectures have cachelines with 64byte length
59 // ARM Cortex-A15 32/64byte, Cortex-A9 16/32/64bytes
60 // MIPS 74K: 32byte, 4KEc: 16byte
61 // ist shoudl be safe to use 64byte for all
62 static constexpr std::size_t cache_alignment{ 64 };
63 static constexpr std::size_t cacheline_length{ 64 };
64
65 #endif // BOOST_FIBERS_DETAIL_CONFIG_H