summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/threading/spin_lock_base.h
blob: dc09f62ead55cc99fcd7172e952e91217347c713 (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
30
31
32
33
34
35
36
37
38
#pragma once

#include <util/system/src_location.h>

namespace NYT::NThreading {

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

class TSpinLockBase
{
public:
    constexpr TSpinLockBase();
    explicit constexpr TSpinLockBase(const ::TSourceLocation& location);

protected:
    const ::TSourceLocation Location_;
};

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

template <class TLock, auto LocationLite>
class TSpinLockInplace
    : public TLock
{
public:
    TSpinLockInplace();
};

#define YT_SPIN_LOCK_INPLACE_TYPE(type) \
    ::NYT::NThreading::TSpinLockInplace<type, YT_CURRENT_SOURCE_LOCATION_LITE>

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

} // namespace NYT::NThreading

#define SPIN_LOCK_BASE_INL_H_
#include "spin_lock_base-inl.h"
#undef SPIN_LOCK_BASE_INL_H_