aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/threading/spin_lock.cpp
blob: 1aa0fe3ef36bbd565a2381d9f8a3859a75a304b3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include "spin_lock.h"

namespace NYT::NThreading {

////////////////////////////////////////////////////////////////////////////////

void TSpinLock::AcquireSlow() noexcept
{
    TSpinWait spinWait(Location_, ESpinLockActivityKind::ReadWrite);
    while (!TryAndTryAcquire()) {
        spinWait.Wait();
    }
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT::NThreading