#include "spin_lock_count.h" #include #include #include namespace NYT::NThreading::NPrivate { #ifndef NDEBUG //////////////////////////////////////////////////////////////////////////////// YT_THREAD_LOCAL(i64) ActiveSpinLockCount = 0; //////////////////////////////////////////////////////////////////////////////// void RecordSpinLockAcquired(bool isAcquired) { if (isAcquired) { ActiveSpinLockCount++; } } void RecordSpinLockReleased() { YT_VERIFY(ActiveSpinLockCount > 0); ActiveSpinLockCount--; } void VerifyNoSpinLockAffinity() { YT_VERIFY(ActiveSpinLockCount == 0); } #endif //////////////////////////////////////////////////////////////////////////////// } // namespace NYT::NThreading::NPrivate