config.hpp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. // Copyright (C) 2001-2003
  2. // William E. Kempf
  3. // Copyright (C) 2011-2013 Vicente J. Botet Escriba
  4. //
  5. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  6. // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  7. #ifndef BOOST_THREAD_CONFIG_WEK01032003_HPP
  8. #define BOOST_THREAD_CONFIG_WEK01032003_HPP
  9. #include <boost/config.hpp>
  10. #include <boost/detail/workaround.hpp>
  11. #include <boost/thread/detail/platform.hpp>
  12. #include <boost/thread/detail/thread_safety.hpp>
  13. //#define BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
  14. // ATTRIBUTE_MAY_ALIAS
  15. //#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
  16. #if !defined(BOOST_NO_MAY_ALIAS)
  17. // GCC since 3.3 and some other compilers have may_alias attribute that helps
  18. // to alleviate optimizer issues with regard to violation of the strict aliasing rules.
  19. #define BOOST_THREAD_DETAIL_USE_ATTRIBUTE_MAY_ALIAS
  20. #endif
  21. #if defined(BOOST_MAY_ALIAS)
  22. #define BOOST_THREAD_ATTRIBUTE_MAY_ALIAS BOOST_MAY_ALIAS
  23. #else
  24. #define BOOST_THREAD_ATTRIBUTE_MAY_ALIAS
  25. #endif
  26. #if defined(BOOST_THREAD_CHRONO_WINDOWS_API)
  27. # warning Boost.Thread will use the Windows API for time
  28. #elif defined(BOOST_THREAD_CHRONO_MAC_API)
  29. # warning Boost.Thread will use the Mac API for time
  30. #elif defined(BOOST_THREAD_CHRONO_POSIX_API)
  31. # warning Boost.Thread will use the POSIX API for time
  32. #endif
  33. # if defined( BOOST_THREAD_CHRONO_WINDOWS_API ) && defined( BOOST_THREAD_CHRONO_POSIX_API )
  34. # error both BOOST_THREAD_CHRONO_WINDOWS_API and BOOST_THREAD_CHRONO_POSIX_API are defined
  35. # elif defined( BOOST_THREAD_CHRONO_WINDOWS_API ) && defined( BOOST_THREAD_CHRONO_MAC_API )
  36. # error both BOOST_THREAD_CHRONO_WINDOWS_API and BOOST_THREAD_CHRONO_MAC_API are defined
  37. # elif defined( BOOST_THREAD_CHRONO_MAC_API ) && defined( BOOST_THREAD_CHRONO_POSIX_API )
  38. # error both BOOST_THREAD_CHRONO_MAC_API and BOOST_THREAD_CHRONO_POSIX_API are defined
  39. # elif !defined( BOOST_THREAD_CHRONO_WINDOWS_API ) && !defined( BOOST_THREAD_CHRONO_MAC_API ) && !defined( BOOST_THREAD_CHRONO_POSIX_API )
  40. # if defined(BOOST_THREAD_PLATFORM_WIN32)
  41. # define BOOST_THREAD_CHRONO_WINDOWS_API
  42. # elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
  43. # define BOOST_THREAD_CHRONO_MAC_API
  44. # else
  45. # define BOOST_THREAD_CHRONO_POSIX_API
  46. # endif
  47. # endif
  48. #if !defined(BOOST_THREAD_POLL_INTERVAL_MILLISECONDS)
  49. #define BOOST_THREAD_POLL_INTERVAL_MILLISECONDS 100
  50. #endif
  51. #if defined BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED
  52. #define BOOST_THREAD_ASSERT_PRECONDITION(EXPR, EX) \
  53. if (EXPR) {} else boost::throw_exception(EX)
  54. #define BOOST_THREAD_VERIFY_PRECONDITION(EXPR, EX) \
  55. if (EXPR) {} else boost::throw_exception(EX)
  56. #define BOOST_THREAD_THROW_ELSE_RETURN(EX, RET) \
  57. boost::throw_exception(EX)
  58. #else
  59. #define BOOST_THREAD_ASSERT_PRECONDITION(EXPR, EX)
  60. #define BOOST_THREAD_VERIFY_PRECONDITION(EXPR, EX) \
  61. (void)(EXPR)
  62. #define BOOST_THREAD_THROW_ELSE_RETURN(EX, RET) \
  63. return (RET)
  64. #endif
  65. // This compiler doesn't support Boost.Chrono
  66. #if defined __IBMCPP__ && (__IBMCPP__ < 1100) \
  67. && ! defined BOOST_THREAD_DONT_USE_CHRONO
  68. #define BOOST_THREAD_DONT_USE_CHRONO
  69. #if ! defined BOOST_THREAD_USES_DATETIME
  70. #define BOOST_THREAD_USES_DATETIME
  71. #endif
  72. #endif
  73. // This compiler doesn't support Boost.Move
  74. #if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) \
  75. && ! defined BOOST_THREAD_DONT_USE_MOVE
  76. #define BOOST_THREAD_DONT_USE_MOVE
  77. #endif
  78. // This compiler doesn't support Boost.Container Allocators files
  79. #if defined __SUNPRO_CC \
  80. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
  81. #define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
  82. #endif
  83. #if defined _WIN32_WCE && _WIN32_WCE==0x501 \
  84. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
  85. #define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS
  86. #endif
  87. #if defined BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX || defined BOOST_NO_CXX11_HDR_INITIALIZER_LIST
  88. #define BOOST_THREAD_NO_CXX11_HDR_INITIALIZER_LIST
  89. #define BOOST_THREAD_NO_MAKE_LOCK_GUARD
  90. #define BOOST_THREAD_NO_MAKE_STRICT_LOCK
  91. #define BOOST_THREAD_NO_MAKE_NESTED_STRICT_LOCK
  92. #endif
  93. #if defined(BOOST_NO_CXX11_HDR_TUPLE) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
  94. #define BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS
  95. #define BOOST_THREAD_NO_SYNCHRONIZE
  96. #elif defined _MSC_VER && _MSC_VER <= 1600
  97. // C++ features supported by VC++ 10 (aka 2010)
  98. #define BOOST_THREAD_NO_MAKE_UNIQUE_LOCKS
  99. #define BOOST_THREAD_NO_SYNCHRONIZE
  100. #endif
  101. /// BASIC_THREAD_ID
  102. #if ! defined BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID \
  103. && ! defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
  104. #define BOOST_THREAD_PROVIDES_BASIC_THREAD_ID
  105. #endif
  106. /// RVALUE_REFERENCES_DONT_MATCH_FUNTION_PTR
  107. //#if defined BOOST_NO_CXX11_RVALUE_REFERENCES || defined BOOST_MSVC
  108. #define BOOST_THREAD_RVALUE_REFERENCES_DONT_MATCH_FUNCTION_PTR
  109. //#endif
  110. // Default version
  111. #if !defined BOOST_THREAD_VERSION
  112. #define BOOST_THREAD_VERSION 2
  113. #else
  114. #if BOOST_THREAD_VERSION!=2 && BOOST_THREAD_VERSION!=3 && BOOST_THREAD_VERSION!=4 && BOOST_THREAD_VERSION!=5
  115. #error "BOOST_THREAD_VERSION must be 2, 3, 4 or 5"
  116. #endif
  117. #endif
  118. // CHRONO
  119. // Uses Boost.Chrono by default if not stated the opposite defining BOOST_THREAD_DONT_USE_CHRONO
  120. #if ! defined BOOST_THREAD_DONT_USE_CHRONO \
  121. && ! defined BOOST_THREAD_USES_CHRONO
  122. #define BOOST_THREAD_USES_CHRONO
  123. #endif
  124. #if ! defined BOOST_THREAD_DONT_USE_ATOMIC \
  125. && ! defined BOOST_THREAD_USES_ATOMIC
  126. #define BOOST_THREAD_USES_ATOMIC
  127. //#define BOOST_THREAD_DONT_USE_ATOMIC
  128. #endif
  129. #if defined BOOST_THREAD_USES_ATOMIC
  130. // Andrey Semashev
  131. #define BOOST_THREAD_ONCE_ATOMIC
  132. #else
  133. //#elif ! defined BOOST_NO_CXX11_THREAD_LOCAL && ! defined BOOST_NO_THREAD_LOCAL && ! defined BOOST_THREAD_NO_UINT32_PSEUDO_ATOMIC
  134. // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html#Appendix
  135. #define BOOST_THREAD_ONCE_FAST_EPOCH
  136. #endif
  137. #if BOOST_THREAD_VERSION==2
  138. // PROVIDE_PROMISE_LAZY
  139. #if ! defined BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY \
  140. && ! defined BOOST_THREAD_PROVIDES_PROMISE_LAZY
  141. #define BOOST_THREAD_PROVIDES_PROMISE_LAZY
  142. #endif
  143. // PROVIDE_THREAD_EQ
  144. #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_EQ \
  145. && ! defined BOOST_THREAD_PROVIDES_THREAD_EQ
  146. #define BOOST_THREAD_PROVIDES_THREAD_EQ
  147. #endif
  148. #endif
  149. #if BOOST_THREAD_VERSION>=3
  150. // ONCE_CXX11
  151. // fixme BOOST_THREAD_PROVIDES_ONCE_CXX11 doesn't works when thread.cpp is compiled BOOST_THREAD_VERSION 3
  152. #if ! defined BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11 \
  153. && ! defined BOOST_THREAD_PROVIDES_ONCE_CXX11
  154. #define BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11
  155. #endif
  156. // THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
  157. #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE \
  158. && ! defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
  159. #define BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE
  160. #endif
  161. // THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
  162. #if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE \
  163. && ! defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
  164. #define BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE
  165. #endif
  166. // PROVIDE_FUTURE
  167. #if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE \
  168. && ! defined BOOST_THREAD_PROVIDES_FUTURE
  169. #define BOOST_THREAD_PROVIDES_FUTURE
  170. #endif
  171. // FUTURE_CTOR_ALLOCATORS
  172. #if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS \
  173. && ! defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
  174. #define BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS
  175. #endif
  176. // SHARED_MUTEX_UPWARDS_CONVERSIONS
  177. #if ! defined BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSIONS \
  178. && ! defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
  179. #define BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
  180. #endif
  181. // PROVIDE_EXPLICIT_LOCK_CONVERSION
  182. #if ! defined BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION \
  183. && ! defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
  184. #define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
  185. #endif
  186. // GENERIC_SHARED_MUTEX_ON_WIN
  187. #if ! defined BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN \
  188. && ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
  189. #define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
  190. #endif
  191. // USE_MOVE
  192. #if ! defined BOOST_THREAD_DONT_USE_MOVE \
  193. && ! defined BOOST_THREAD_USES_MOVE
  194. #define BOOST_THREAD_USES_MOVE
  195. #endif
  196. #endif
  197. // deprecated since version 4
  198. #if BOOST_THREAD_VERSION < 4
  199. // NESTED_LOCKS
  200. #if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS \
  201. && ! defined BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
  202. #define BOOST_THREAD_PROVIDES_NESTED_LOCKS
  203. #endif
  204. // CONDITION
  205. #if ! defined BOOST_THREAD_PROVIDES_CONDITION \
  206. && ! defined BOOST_THREAD_DONT_PROVIDE_CONDITION
  207. #define BOOST_THREAD_PROVIDES_CONDITION
  208. #endif
  209. // USE_DATETIME
  210. #if ! defined BOOST_THREAD_DONT_USE_DATETIME \
  211. && ! defined BOOST_THREAD_USES_DATETIME
  212. #define BOOST_THREAD_USES_DATETIME
  213. #endif
  214. #endif
  215. #if BOOST_THREAD_VERSION>=4
  216. // SIGNATURE_PACKAGED_TASK
  217. #if ! defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK \
  218. && ! defined BOOST_THREAD_DONT_PROVIDE_SIGNATURE_PACKAGED_TASK
  219. #define BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK
  220. #endif
  221. // VARIADIC_THREAD
  222. #if ! defined BOOST_THREAD_PROVIDES_VARIADIC_THREAD \
  223. && ! defined BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD
  224. #if ! defined(BOOST_NO_SFINAE_EXPR) && \
  225. ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
  226. ! defined(BOOST_NO_CXX11_DECLTYPE) && \
  227. ! defined(BOOST_NO_CXX11_DECLTYPE_N3276) && \
  228. ! defined(BOOST_NO_CXX11_TRAILING_RESULT_TYPES) && \
  229. ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \
  230. ! defined(BOOST_NO_CXX11_HDR_TUPLE)
  231. #define BOOST_THREAD_PROVIDES_VARIADIC_THREAD
  232. #endif
  233. #endif
  234. #if ! defined BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY \
  235. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_WHEN_ALL_WHEN_ANY
  236. #if ! defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && \
  237. ! defined(BOOST_NO_CXX11_HDR_TUPLE)
  238. #define BOOST_THREAD_PROVIDES_FUTURE_WHEN_ALL_WHEN_ANY
  239. #endif
  240. #endif
  241. // ! defined(BOOST_NO_SFINAE_EXPR) &&
  242. // ! defined(BOOST_NO_CXX11_RVALUE_REFERENCES) &&
  243. // ! defined(BOOST_NO_CXX11_AUTO) &&
  244. // ! defined(BOOST_NO_CXX11_DECLTYPE) &&
  245. // ! defined(BOOST_NO_CXX11_DECLTYPE_N3276) &&
  246. // MAKE_READY_AT_THREAD_EXIT
  247. #if ! defined BOOST_THREAD_PROVIDES_MAKE_READY_AT_THREAD_EXIT \
  248. && ! defined BOOST_THREAD_DONT_PROVIDE_MAKE_READY_AT_THREAD_EXIT
  249. //#if defined BOOST_THREAD_PROVIDES_SIGNATURE_PACKAGED_TASK && defined(BOOST_THREAD_PROVIDES_VARIADIC_THREAD)
  250. #define BOOST_THREAD_PROVIDES_MAKE_READY_AT_THREAD_EXIT
  251. //#endif
  252. #endif
  253. // FUTURE_CONTINUATION
  254. #if ! defined BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION \
  255. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CONTINUATION
  256. #define BOOST_THREAD_PROVIDES_FUTURE_CONTINUATION
  257. #endif
  258. #if ! defined BOOST_THREAD_PROVIDES_FUTURE_UNWRAP \
  259. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_UNWRAP
  260. #define BOOST_THREAD_PROVIDES_FUTURE_UNWRAP
  261. #endif
  262. // FUTURE_INVALID_AFTER_GET
  263. #if ! defined BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET \
  264. && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_INVALID_AFTER_GET
  265. #define BOOST_THREAD_PROVIDES_FUTURE_INVALID_AFTER_GET
  266. #endif
  267. // NESTED_LOCKS
  268. #if ! defined BOOST_THREAD_PROVIDES_NESTED_LOCKS \
  269. && ! defined BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
  270. #define BOOST_THREAD_DONT_PROVIDE_NESTED_LOCKS
  271. #endif
  272. // CONDITION
  273. #if ! defined BOOST_THREAD_PROVIDES_CONDITION \
  274. && ! defined BOOST_THREAD_DONT_PROVIDE_CONDITION
  275. #define BOOST_THREAD_DONT_PROVIDE_CONDITION
  276. #endif
  277. #endif // BOOST_THREAD_VERSION>=4
  278. #if BOOST_THREAD_VERSION>=5
  279. //#define BOOST_THREAD_FUTURE_BLOCKING
  280. #if ! defined BOOST_THREAD_PROVIDES_EXECUTORS \
  281. && ! defined BOOST_THREAD_DONT_PROVIDE_EXECUTORS
  282. #define BOOST_THREAD_PROVIDES_EXECUTORS
  283. #endif
  284. #else
  285. //#define BOOST_THREAD_FUTURE_BLOCKING
  286. #define BOOST_THREAD_ASYNC_FUTURE_WAITS
  287. #endif
  288. // INTERRUPTIONS
  289. #if ! defined BOOST_THREAD_PROVIDES_INTERRUPTIONS \
  290. && ! defined BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
  291. #define BOOST_THREAD_PROVIDES_INTERRUPTIONS
  292. #endif
  293. // CORRELATIONS
  294. // EXPLICIT_LOCK_CONVERSION.
  295. #if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION
  296. #define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit
  297. #else
  298. #define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION
  299. #endif
  300. // BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN is defined if BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS
  301. #if defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS \
  302. && ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
  303. #define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN
  304. #endif
  305. // For C++11 call_once interface the compiler MUST support constexpr.
  306. // Otherwise once_flag would be initialized during dynamic initialization stage, which is not thread-safe.
  307. #if defined(BOOST_THREAD_PROVIDES_ONCE_CXX11)
  308. #if defined(BOOST_NO_CXX11_CONSTEXPR)
  309. #undef BOOST_THREAD_PROVIDES_ONCE_CXX11
  310. #endif
  311. #endif
  312. #if defined(BOOST_THREAD_PLATFORM_WIN32) && defined BOOST_THREAD_DONT_USE_DATETIME
  313. #undef BOOST_THREAD_DONT_USE_DATETIME
  314. #define BOOST_THREAD_USES_DATETIME
  315. #endif
  316. #if defined(BOOST_THREAD_PLATFORM_WIN32) && defined BOOST_THREAD_DONT_USE_CHRONO
  317. #undef BOOST_THREAD_DONT_USE_CHRONO
  318. #define BOOST_THREAD_USES_CHRONO
  319. #endif
  320. // BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55
  321. // BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55
  322. #if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0
  323. #if ! defined BOOST_THREAD_PROVIDES_THREAD_EQ
  324. #define BOOST_THREAD_PROVIDES_THREAD_EQ
  325. #endif
  326. #endif
  327. //#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES || defined BOOST_THREAD_USES_MOVE
  328. #if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES
  329. #define BOOST_THREAD_FUTURE_USES_OPTIONAL
  330. #endif
  331. #if BOOST_WORKAROUND(BOOST_BORLANDC, < 0x600)
  332. # pragma warn -8008 // Condition always true/false
  333. # pragma warn -8080 // Identifier declared but never used
  334. # pragma warn -8057 // Parameter never used
  335. # pragma warn -8066 // Unreachable code
  336. #endif
  337. #include <boost/thread/detail/platform.hpp>
  338. #if defined(BOOST_THREAD_PLATFORM_WIN32)
  339. #else
  340. # if defined(BOOST_HAS_PTHREAD_DELAY_NP) || defined(BOOST_HAS_NANOSLEEP)
  341. # define BOOST_THREAD_SLEEP_FOR_IS_STEADY
  342. # endif
  343. #endif
  344. #if defined(BOOST_THREAD_CHRONO_WINDOWS_API)
  345. #define BOOST_THREAD_HAS_MONO_CLOCK
  346. #define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
  347. #elif defined(BOOST_THREAD_CHRONO_MAC_API)
  348. #define BOOST_THREAD_HAS_MONO_CLOCK
  349. #elif defined(__ANDROID__)
  350. #define BOOST_THREAD_HAS_MONO_CLOCK
  351. #if defined(__ANDROID_API__) && __ANDROID_API__ >= 21
  352. #define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
  353. #endif
  354. #else
  355. #include <time.h> // check for CLOCK_MONOTONIC
  356. #if defined(CLOCK_MONOTONIC)
  357. #define BOOST_THREAD_HAS_MONO_CLOCK
  358. #define BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
  359. #endif
  360. #endif
  361. #if defined(BOOST_THREAD_PLATFORM_WIN32)
  362. #elif ! defined BOOST_THREAD_INTERNAL_CLOCK_IS_MONO
  363. #if defined BOOST_PTHREAD_HAS_TIMEDLOCK
  364. #define BOOST_THREAD_USES_PTHREAD_TIMEDLOCK
  365. #elif (defined(_POSIX_TIMEOUTS) && (_POSIX_TIMEOUTS-0)>=200112L) \
  366. || (defined(__ANDROID__) && defined(__ANDROID_API__) && __ANDROID_API__ >= 21)
  367. #define BOOST_THREAD_USES_PTHREAD_TIMEDLOCK
  368. #endif
  369. #endif
  370. // provided for backwards compatibility, since this
  371. // macro was used for several releases by mistake.
  372. #if defined(BOOST_THREAD_DYN_DLL) && ! defined(BOOST_THREAD_DYN_LINK)
  373. # define BOOST_THREAD_DYN_LINK
  374. #endif
  375. // compatibility with the rest of Boost's auto-linking code:
  376. #if defined(BOOST_THREAD_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
  377. # undef BOOST_THREAD_USE_LIB
  378. # if !defined(BOOST_THREAD_USE_DLL)
  379. # define BOOST_THREAD_USE_DLL
  380. # endif
  381. #endif
  382. #if defined(BOOST_THREAD_BUILD_DLL) //Build dll
  383. #elif defined(BOOST_THREAD_BUILD_LIB) //Build lib
  384. #elif defined(BOOST_THREAD_USE_DLL) //Use dll
  385. #elif defined(BOOST_THREAD_USE_LIB) //Use lib
  386. #else //Use default
  387. # if defined(BOOST_THREAD_PLATFORM_WIN32)
  388. # if defined(BOOST_MSVC) || defined(BOOST_INTEL_WIN) \
  389. || defined(__MINGW32__) || defined(MINGW32) || defined(BOOST_MINGW32) \
  390. || (defined(_MSC_VER) && defined(__clang__))
  391. //For compilers supporting auto-tss cleanup
  392. //with Boost.Threads lib, use Boost.Threads lib
  393. # define BOOST_THREAD_USE_LIB
  394. # else
  395. //For compilers not yet supporting auto-tss cleanup
  396. //with Boost.Threads lib, use Boost.Threads dll
  397. # define BOOST_THREAD_USE_DLL
  398. # endif
  399. # else
  400. # define BOOST_THREAD_USE_LIB
  401. # endif
  402. #endif
  403. #if defined(BOOST_HAS_DECLSPEC)
  404. # if defined(BOOST_THREAD_BUILD_DLL) //Build dll
  405. # define BOOST_THREAD_DECL BOOST_SYMBOL_EXPORT
  406. //# define BOOST_THREAD_DECL __declspec(dllexport)
  407. # elif defined(BOOST_THREAD_USE_DLL) //Use dll
  408. # define BOOST_THREAD_DECL BOOST_SYMBOL_IMPORT
  409. //# define BOOST_THREAD_DECL __declspec(dllimport)
  410. # else
  411. # define BOOST_THREAD_DECL
  412. # endif
  413. #elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
  414. # define BOOST_THREAD_DECL BOOST_SYMBOL_VISIBLE
  415. #else
  416. # define BOOST_THREAD_DECL
  417. #endif // BOOST_HAS_DECLSPEC
  418. //
  419. // Automatically link to the correct build variant where possible.
  420. //
  421. #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_THREAD_NO_LIB) && !defined(BOOST_THREAD_BUILD_DLL) && !defined(BOOST_THREAD_BUILD_LIB)
  422. //
  423. // Tell the autolink to link dynamically, this will get undef'ed by auto_link.hpp
  424. // once it's done with it:
  425. //
  426. #if defined(BOOST_THREAD_USE_DLL) & ! defined(BOOST_DYN_LINK)
  427. # define BOOST_DYN_LINK
  428. #endif
  429. //
  430. // Set the name of our library, this will get undef'ed by auto_link.hpp
  431. // once it's done with it:
  432. //
  433. #if defined(BOOST_THREAD_LIB_NAME)
  434. # define BOOST_LIB_NAME BOOST_THREAD_LIB_NAME
  435. #else
  436. # define BOOST_LIB_NAME boost_thread
  437. #endif
  438. //
  439. // If we're importing code from a dll, then tell auto_link.hpp about it:
  440. //
  441. // And include the header that does the work:
  442. //
  443. #include <boost/config/auto_link.hpp>
  444. #endif // auto-linking disabled
  445. #endif // BOOST_THREAD_CONFIG_WEK1032003_HPP
  446. // Change Log:
  447. // 22 Jan 05 Roland Schwarz (speedsnail)
  448. // Usage of BOOST_HAS_DECLSPEC macro.
  449. // Default again is static lib usage.
  450. // BOOST_DYN_LINK only defined when autolink included.