thread.h 703 B

123456789101112131415161718192021222324252627
  1. // Copyright (c) 2006-2018 Maxim Khizhinsky
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See accompanying
  4. // file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)
  5. #ifndef CDSLIB_OS_THREAD_H
  6. #define CDSLIB_OS_THREAD_H
  7. #include <thread>
  8. #include <cds/details/defs.h>
  9. #if CDS_OS_TYPE == CDS_OS_WIN32 || CDS_OS_TYPE == CDS_OS_WIN64 || CDS_OS_TYPE == CDS_OS_MINGW
  10. # include <cds/os/win/thread.h>
  11. #else
  12. # include <cds/os/posix/thread.h>
  13. #endif
  14. namespace cds { namespace OS {
  15. /// Default backoff::yield implementation
  16. static inline void backoff()
  17. {
  18. std::this_thread::yield();
  19. }
  20. }} // namespace cds::OS
  21. #endif // #ifndef CDSLIB_OS_THREAD_H