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)
7 #ifndef BOOST_FIBERS_DETAIL_CONFIG_H
8 #define BOOST_FIBERS_DETAIL_CONFIG_H
12 #include <boost/config.hpp>
13 #include <boost/predef.h>
14 #include <boost/detail/workaround.hpp>
16 #ifdef BOOST_FIBERS_DECL
17 # undef BOOST_FIBERS_DECL
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
25 # define BOOST_FIBERS_DECL BOOST_SYMBOL_IMPORT
29 #if ! defined(BOOST_FIBERS_DECL)
30 # define BOOST_FIBERS_DECL
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
38 # include <boost/config/auto_link.hpp>
41 #if BOOST_OS_LINUX || BOOST_OS_WINDOWS
42 # define BOOST_FIBERS_HAS_FUTEX
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"
50 #if !defined(BOOST_FIBERS_SPIN_MAX_COLLISIONS)
51 # define BOOST_FIBERS_SPIN_MAX_COLLISIONS 16
54 #if !defined(BOOST_FIBERS_SPIN_MAX_TESTS)
55 # define BOOST_FIBERS_SPIN_MAX_TESTS 500
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 };
65 #endif // BOOST_FIBERS_DETAIL_CONFIG_H