userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
striped_counter.hpp
Go to the documentation of this file.
1
#pragma once
2
5
6
#include <cstdint>
7
8
#include <
userver/utils/fast_pimpl.hpp
>
9
10
USERVER_NAMESPACE_BEGIN
11
12
namespace
concurrent
{
13
25
class
StripedCounter
final {
26
public
:
30
StripedCounter
();
31
~StripedCounter
();
32
33
StripedCounter
(
const
StripedCounter
&) =
delete
;
34
StripedCounter
& operator=(
const
StripedCounter
&) =
delete
;
35
36
StripedCounter
(
StripedCounter
&&) =
delete
;
37
StripedCounter
& operator=(
StripedCounter
&&) =
delete
;
38
40
void
Add
(std::uintptr_t value)
noexcept
;
41
43
void
Subtract
(std::uintptr_t value)
noexcept
{
44
// Perfectly defined unsigned wrapping
45
Add
(-value);
46
}
47
57
std::uintptr_t
Read
() const noexcept;
58
66
std
::uintptr_t
NonNegativeRead
() const noexcept;
67
68
private:
69
struct Impl;
70
utils
::FastPimpl<Impl, 32, 8> impl_;
71
};
72
73
}
// namespace concurrent
74
75
USERVER_NAMESPACE_END
userver
concurrent
striped_counter.hpp
Generated on
for userver by
Doxygen
1.17.0