tls.h 553 B

12345678910111213141516171819202122
  1. #pragma once
  2. #include <util/system/compiler.h>
  3. // Workaround for fiber (un)friendly TLS.
  4. // Volatile qualifier prevents caching access to thread local variables.
  5. #define YT_THREAD_LOCAL(...) thread_local __VA_ARGS__ volatile
  6. namespace NYT {
  7. ////////////////////////////////////////////////////////////////////////////////
  8. template <class T>
  9. Y_FORCE_INLINE T& GetTlsRef(volatile T& arg);
  10. ////////////////////////////////////////////////////////////////////////////////
  11. } // namespace NYT
  12. #define TLS_INL_H_
  13. #include "tls-inl.h"
  14. #undef TLS_INL_H_