blob: 844d80ea7a903bb9709e32a422bca42be90ba3d0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#include "fork_aware_spin_lock.h"
#include "at_fork.h"
namespace NYT::NThreading {
////////////////////////////////////////////////////////////////////////////////
void TForkAwareSpinLock::Acquire() noexcept
{
GetForkLock()->AcquireReaderForkFriendly();
SpinLock_.Acquire();
}
void TForkAwareSpinLock::Release() noexcept
{
SpinLock_.Release();
GetForkLock()->ReleaseReader();
}
bool TForkAwareSpinLock::IsLocked() const noexcept
{
return SpinLock_.IsLocked();
}
////////////////////////////////////////////////////////////////////////////////
} // namespace NYT::NThreading
|