summaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/memory/atomic.h
blob: b4a1dd7234ab6be052cc6cbf3ee7996d39653366 (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
#pragma once

#include <atomic>

namespace NYT {

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

//! A (much) faster version of |fetch_add| for a single-writer case.
template <class T>
T SingleWriterFetchAdd(std::atomic<T>& atomic, T delta);

//! A (much) faster version of |fetch_sub| for a single-writer case.
template <class T>
T SingleWriterFetchSub(std::atomic<T>& atomic, T delta);

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

} // namespace NYT

#define ATOMIC_INL_H_
#include "atomic-inl.h"
#undef ATOMIC_INL_H_