thread 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright (c) 2005-2020 Intel Corporation
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. #include "../internal/_deprecated_header_message_guard.h"
  14. #if !defined(__TBB_show_deprecation_message_thread_H) && defined(__TBB_show_deprecated_header_message)
  15. #define __TBB_show_deprecation_message_thread_H
  16. #pragma message("TBB Warning: tbb/compat/thread is deprecated. For details, please see Deprecated Features appendix in the TBB reference manual.")
  17. #endif
  18. #if defined(__TBB_show_deprecated_header_message)
  19. #undef __TBB_show_deprecated_header_message
  20. #endif
  21. #ifndef __TBB_thread_H
  22. #define __TBB_thread_H
  23. #define __TBB_thread_H_include_area
  24. #include "../internal/_warning_suppress_enable_notice.h"
  25. #include "../tbb_config.h"
  26. #if TBB_IMPLEMENT_CPP0X
  27. #include "../tbb_thread.h"
  28. namespace std {
  29. typedef tbb::tbb_thread thread;
  30. namespace this_thread {
  31. using tbb::this_tbb_thread::get_id;
  32. using tbb::this_tbb_thread::yield;
  33. __TBB_DEPRECATED_IN_VERBOSE_MODE inline void sleep_for(const tbb::tick_count::interval_t& rel_time) {
  34. tbb::internal::thread_sleep_v3( rel_time );
  35. }
  36. }
  37. } // namespace std
  38. #else /* TBB_IMPLEMENT_CPP0X */
  39. #define __TBB_COMPAT_THREAD_RECURSION_PROTECTOR 1
  40. #include <thread>
  41. #undef __TBB_COMPAT_THREAD_RECURSION_PROTECTOR
  42. #endif /* TBB_IMPLEMENT_CPP0X */
  43. #include "../internal/_warning_suppress_disable_notice.h"
  44. #undef __TBB_thread_H_include_area
  45. #else /* __TBB_thread_H */
  46. #if __TBB_COMPAT_THREAD_RECURSION_PROTECTOR
  47. #error The tbb/compat/thread header attempts to include itself. \
  48. Please make sure that {TBBROOT}/include/tbb/compat is NOT in include paths.
  49. #endif
  50. #endif /* __TBB_thread_H */