diff options
author | robot-piglet <robot-piglet@yandex-team.com> | 2023-05-23 20:06:46 +0300 |
---|---|---|
committer | robot-piglet <robot-piglet@yandex-team.com> | 2023-05-23 20:06:46 +0300 |
commit | 0d0afc40a0d7e0535403cfe00efb2b1e5a9dfaef (patch) | |
tree | 57b6a38bcc4b21fd2b362762bb0ea0b1551cb03a | |
parent | 50a138c06e4801795c1552ce13ffaf138bc1d8bd (diff) | |
download | ydb-0d0afc40a0d7e0535403cfe00efb2b1e5a9dfaef.tar.gz |
Intermediate changes
-rw-r--r-- | library/cpp/yt/threading/spin_lock-inl.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/cpp/yt/threading/spin_lock-inl.h b/library/cpp/yt/threading/spin_lock-inl.h index dd7c219725..2e7b038eaf 100644 --- a/library/cpp/yt/threading/spin_lock-inl.h +++ b/library/cpp/yt/threading/spin_lock-inl.h @@ -34,7 +34,7 @@ inline void TSpinLock::Release() noexcept inline bool TSpinLock::IsLocked() const noexcept { - return Value_.load() != UnlockedValue; + return Value_.load(std::memory_order::relaxed) != UnlockedValue; } inline bool TSpinLock::TryAcquire() noexcept @@ -45,7 +45,11 @@ inline bool TSpinLock::TryAcquire() noexcept #else auto newValue = LockedValue; #endif - return Value_.compare_exchange_weak(expectedValue, newValue); + return Value_.compare_exchange_weak( + expectedValue, + newValue, + std::memory_order::acquire, + std::memory_order::relaxed); } inline bool TSpinLock::TryAndTryAcquire() noexcept |