thread_id.cpp 615 B

1234567891011121314151617181920
  1. #include "thread_id.h"
  2. #include <util/system/thread.h>
  3. namespace NYT {
  4. ////////////////////////////////////////////////////////////////////////////////
  5. YT_DEFINE_THREAD_LOCAL(TSequentialThreadId, CachedSequentialThreadId, InvalidSequentialThreadId);
  6. std::atomic<TSequentialThreadId> SequentialThreadIdGenerator = InvalidSequentialThreadId;
  7. TSystemThreadId GetSystemThreadId()
  8. {
  9. static_assert(std::is_same_v<TSystemThreadId, ::TThread::TId>);
  10. return ::TThread::CurrentThreadNumericId();
  11. }
  12. ////////////////////////////////////////////////////////////////////////////////
  13. } // namespace NYT::NThreading