diff options
| author | YDBot <[email protected]> | 2026-07-02 18:29:58 +0000 |
|---|---|---|
| committer | YDBot <[email protected]> | 2026-07-02 18:29:58 +0000 |
| commit | a52ffb856a584a5099e37b9c060da3ba4a3db5fb (patch) | |
| tree | 59c7f09bdc9e52d11ce6ddf8b6fabdfe1e73a8d6 /library/cpp/yt/threading/rw_spin_lock.cpp | |
| parent | 6faa15e1fbe202f0fddb7c1ffe9886dc81a0425f (diff) | |
| parent | d5cfc51dd97284c59104c50bb156d1a8d9a09dac (diff) | |
Merge pull request #45225 from ydb-platform/merge-rightlib-260701-1735
Diffstat (limited to 'library/cpp/yt/threading/rw_spin_lock.cpp')
| -rw-r--r-- | library/cpp/yt/threading/rw_spin_lock.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/library/cpp/yt/threading/rw_spin_lock.cpp b/library/cpp/yt/threading/rw_spin_lock.cpp index efc0e90167a..3150c1aa132 100644 --- a/library/cpp/yt/threading/rw_spin_lock.cpp +++ b/library/cpp/yt/threading/rw_spin_lock.cpp @@ -41,7 +41,8 @@ void TUncheckedReaderWriterSpinLock::AcquireWriterSlow() noexcept namespace { -// NB: Reading this after destruction is UB, but we can't deal with Static Initialization Order Fiasco in any other feasible way :( +// NB: Reading this after destruction is UB, but we can't deal with +// Static Initialization Order Fiasco in any other feasible way :( YT_DEFINE_THREAD_LOCAL(bool, ThreadLockTrackerDestroyed, false); class TThreadLockTracker @@ -61,13 +62,17 @@ public: ~TThreadLockTracker() { ThreadLockTrackerDestroyed() = true; - }; + } private: THashSet<TCheckedReaderWriterSpinLock*> ThreadLocksAcquired_; }; -YT_DEFINE_THREAD_LOCAL(TThreadLockTracker, ThreadLockTracker); +YT_PREVENT_TLS_CACHING static TThreadLockTracker& ThreadLockTracker() +{ + static thread_local TThreadLockTracker Instance; + return Instance; +} } // namespace |
