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