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

namespace NYT::NThreading {

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

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

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

} // namespace NYT::NThreading