diff options
author | lukyan <lukyan@yandex-team.com> | 2023-11-12 19:20:01 +0300 |
---|---|---|
committer | lukyan <lukyan@yandex-team.com> | 2023-11-12 19:43:01 +0300 |
commit | 000b2d18bdca23a7b7d1f40506115880caa62ac4 (patch) | |
tree | 266aa366dbf50af6513c1a9af5694db2af59fca1 /yt | |
parent | 49b4f30439166504566307aa3507a2c0bcb6dbfa (diff) | |
download | ydb-000b2d18bdca23a7b7d1f40506115880caa62ac4.tar.gz |
Do not use static with thread local variables
Diffstat (limited to 'yt')
-rw-r--r-- | yt/yt/core/concurrency/fiber_scheduler_thread.cpp | 6 | ||||
-rw-r--r-- | yt/yt/core/logging/log_manager.cpp | 4 | ||||
-rw-r--r-- | yt/yt/core/misc/hazard_ptr.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/misc/pool_allocator-inl.h | 2 | ||||
-rw-r--r-- | yt/yt/core/misc/ref_counted_tracker.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/rpc/service_detail.cpp | 2 | ||||
-rw-r--r-- | yt/yt/core/threading/thread.cpp | 4 | ||||
-rw-r--r-- | yt/yt/library/ytprof/spinlock_profiler.cpp | 4 |
8 files changed, 13 insertions, 13 deletions
diff --git a/yt/yt/core/concurrency/fiber_scheduler_thread.cpp b/yt/yt/core/concurrency/fiber_scheduler_thread.cpp index bc605647cb..4969f3b832 100644 --- a/yt/yt/core/concurrency/fiber_scheduler_thread.cpp +++ b/yt/yt/core/concurrency/fiber_scheduler_thread.cpp @@ -87,16 +87,16 @@ struct TFiberContext TFiberPtr CurrentFiber; }; -static YT_THREAD_LOCAL(TFiberContext*) FiberContext; +YT_THREAD_LOCAL(TFiberContext*) FiberContext; // Forbid inlining these accessors to prevent the compiler from // miss-optimizing TLS access in presence of fiber context switches. -Y_NO_INLINE TFiberContext* TryGetFiberContext() +TFiberContext* TryGetFiberContext() { return FiberContext; } -Y_NO_INLINE void SetFiberContext(TFiberContext* context) +void SetFiberContext(TFiberContext* context) { FiberContext = context; } diff --git a/yt/yt/core/logging/log_manager.cpp b/yt/yt/core/logging/log_manager.cpp index 99ee1bb448..3350071d1f 100644 --- a/yt/yt/core/logging/log_manager.cpp +++ b/yt/yt/core/logging/log_manager.cpp @@ -358,7 +358,7 @@ TCpuInstant GetEventInstant(const TLoggerQueueItem& item) using TThreadLocalQueue = TSpscQueue<TLoggerQueueItem>; static constexpr uintptr_t ThreadQueueDestroyedSentinel = -1; -static YT_THREAD_LOCAL(TThreadLocalQueue*) PerThreadQueue; +YT_THREAD_LOCAL(TThreadLocalQueue*) PerThreadQueue; ///////////////////////////////////////////////////////////////////////////// @@ -1462,7 +1462,7 @@ struct TLocalQueueReclaimer } }; -static YT_THREAD_LOCAL(TLocalQueueReclaimer) LocalQueueReclaimer; +YT_THREAD_LOCAL(TLocalQueueReclaimer) LocalQueueReclaimer; //////////////////////////////////////////////////////////////////////////////// diff --git a/yt/yt/core/misc/hazard_ptr.cpp b/yt/yt/core/misc/hazard_ptr.cpp index 6ba356bf0b..35da3c4b78 100644 --- a/yt/yt/core/misc/hazard_ptr.cpp +++ b/yt/yt/core/misc/hazard_ptr.cpp @@ -273,7 +273,7 @@ THazardThreadState* THazardPointerManager::AllocateThreadState() }; // Unregisters thread from hazard ptr manager on thread exit. - static YT_THREAD_LOCAL(THazardThreadStateDestroyer) destroyer{threadState}; + YT_THREAD_LOCAL(THazardThreadStateDestroyer) destroyer{threadState}; { auto guard = WriterGuard(ThreadRegistryLock_); diff --git a/yt/yt/core/misc/pool_allocator-inl.h b/yt/yt/core/misc/pool_allocator-inl.h index f538228244..4d33816df4 100644 --- a/yt/yt/core/misc/pool_allocator-inl.h +++ b/yt/yt/core/misc/pool_allocator-inl.h @@ -72,7 +72,7 @@ std::unique_ptr<T> TPoolAllocator::New(TArgs&&... args) struct TChunkTag { }; constexpr auto ChunkSize = 64_KB; - static YT_THREAD_LOCAL(TPoolAllocator) Allocator( + YT_THREAD_LOCAL(TPoolAllocator) Allocator( sizeof(T), alignof(T), ChunkSize, diff --git a/yt/yt/core/misc/ref_counted_tracker.cpp b/yt/yt/core/misc/ref_counted_tracker.cpp index 6cc0dd2a2d..c15ceb840d 100644 --- a/yt/yt/core/misc/ref_counted_tracker.cpp +++ b/yt/yt/core/misc/ref_counted_tracker.cpp @@ -431,7 +431,7 @@ TRefCountedTracker::TLocalSlot* TRefCountedTracker::GetLocalSlot(TRefCountedType } }; - static YT_THREAD_LOCAL(TReclaimer) Reclaimer; + YT_THREAD_LOCAL(TReclaimer) Reclaimer; YT_VERIFY(LocalSlotsSize_ >= 0); diff --git a/yt/yt/core/rpc/service_detail.cpp b/yt/yt/core/rpc/service_detail.cpp index 067a057e75..7a04ab78ed 100644 --- a/yt/yt/core/rpc/service_detail.cpp +++ b/yt/yt/core/rpc/service_detail.cpp @@ -1297,7 +1297,7 @@ void TRequestQueue::OnRequestFinished() // Prevents reentrant invocations. // One case is: RunRequest calling the handler synchronously, which replies the // context, which calls context->Finish, and we're back here again. -static YT_THREAD_LOCAL(bool) ScheduleRequestsLatch = false; +YT_THREAD_LOCAL(bool) ScheduleRequestsLatch = false; void TRequestQueue::ScheduleRequestsFromQueue() { diff --git a/yt/yt/core/threading/thread.cpp b/yt/yt/core/threading/thread.cpp index 1aecb9242e..57a7cbfdbc 100644 --- a/yt/yt/core/threading/thread.cpp +++ b/yt/yt/core/threading/thread.cpp @@ -16,7 +16,7 @@ namespace NYT::NThreading { //////////////////////////////////////////////////////////////////////////////// -static YT_THREAD_LOCAL(TThreadId) CurrentUniqueThreadId; +YT_THREAD_LOCAL(TThreadId) CurrentUniqueThreadId; static std::atomic<TThreadId> UniqueThreadIdGenerator; static const auto& Logger = ThreadingLogger; @@ -220,7 +220,7 @@ void TThread::ThreadMainTrampoline() bool Armed_ = true; }; - static YT_THREAD_LOCAL(TExitInterceptor) Interceptor; + YT_THREAD_LOCAL(TExitInterceptor) Interceptor; ThreadMain(); diff --git a/yt/yt/library/ytprof/spinlock_profiler.cpp b/yt/yt/library/ytprof/spinlock_profiler.cpp index f6fc756703..e1a2fa58e3 100644 --- a/yt/yt/library/ytprof/spinlock_profiler.cpp +++ b/yt/yt/library/ytprof/spinlock_profiler.cpp @@ -66,7 +66,7 @@ void TSpinlockProfiler::RecordEvent(const void* /*lock*/, int64_t waitCycles) RecordSample(&fpCursor, waitCycles); } -static YT_THREAD_LOCAL(int) SpinlockEventCount; +YT_THREAD_LOCAL(int) SpinlockEventCount; void TSpinlockProfiler::OnEvent(const void* lock, int64_t waitCycles) { @@ -171,7 +171,7 @@ void TBlockingProfiler::RecordEvent( RecordSample(&fpCursor, cpuDelay); } -static YT_THREAD_LOCAL(int) YTSpinlockEventCount; +YT_THREAD_LOCAL(int) YTSpinlockEventCount; void TBlockingProfiler::OnEvent( TCpuDuration cpuDelay, |