#ifndef THREAD_ID_INL_H_ #error "Direct inclusion of this file is not allowed, include thread_id.h" // For the sake of sane code completion. #include "thread_id.h" #endif #include #include #include namespace NYT { //////////////////////////////////////////////////////////////////////////////// YT_DECLARE_THREAD_LOCAL(TSequentialThreadId, CachedSequentialThreadId); extern std::atomic SequentialThreadIdGenerator; inline TSequentialThreadId GetSequentialThreadId() { auto& cachedSequentialThreadId = CachedSequentialThreadId(); if (Y_UNLIKELY(cachedSequentialThreadId == InvalidSequentialThreadId)) { cachedSequentialThreadId = ++SequentialThreadIdGenerator; } return cachedSequentialThreadId; } //////////////////////////////////////////////////////////////////////////////// } // namespace NYT