userver
C++ Async Framework
Toggle main menu visibility
Loading...
Searching...
No Matches
queue_fwd.hpp
Go to the documentation of this file.
1
#
pragma
once
2
3
/// @file userver/concurrent/queue_fwd.hpp
4
/// @brief Forward declarations for @ref concurrent::GenericQueue and its queue aliases.
5
6
#
include
<
string
>
7
8
USERVER_NAMESPACE_BEGIN
9
10
namespace
concurrent
{
11
12
namespace
impl {
13
14
struct
NoToken;
15
16
template
<
typename
Queue>
17
class
QueueEmplaceEnabler;
18
19
template
<
bool
MultipleProducer,
bool
MultipleConsumer>
20
struct
SimpleQueuePolicy;
21
22
template
<
bool
MultipleProducer,
bool
MultipleConsumer>
23
struct
NoMaxSizeQueuePolicy;
24
25
template
<
bool
MultipleProducer,
bool
MultipleConsumer>
26
struct
ContainerQueuePolicy;
27
28
}
// namespace impl
29
30
template
<
typename
T,
typename
QueuePolicy>
31
class
GenericQueue;
32
33
template
<
typename
QueueType,
typename
ConsumerToken,
typename
EmplaceEnablerType>
34
class
Consumer
;
35
36
/// @ingroup userver_concurrency
37
///
38
/// @brief Non FIFO multiple producers multiple consumers queue.
39
///
40
/// Items from the same producer are always delivered in the production order.
41
/// Items from different producers (or when using a `MultiProducer` token) are
42
/// delivered in an unspecified order. In other words, FIFO order is maintained
43
/// only within producers, but not between them. This may lead to increased peak
44
/// latency of item processing.
45
///
46
/// In exchange for this, the queue has lower contention and increased
47
/// throughput compared to a conventional lock-free queue.
48
///
49
/// @see @ref scripts/docs/en/userver/synchronization.md
50
template
<
typename
T>
51
using
NonFifoMpmcQueue
= GenericQueue<T, impl::SimpleQueuePolicy<
true
,
true
>>;
52
53
/// @ingroup userver_concurrency
54
///
55
/// @brief Non FIFO multiple producers single consumer queue.
56
///
57
/// @see @ref concurrent::NonFifoMpmcQueue for the description of what NonFifo means.
58
/// @see @ref scripts/docs/en/userver/synchronization.md
59
template
<
typename
T>
60
using
NonFifoMpscQueue
= GenericQueue<T, impl::SimpleQueuePolicy<
true
,
false
>>;
61
62
/// @ingroup userver_concurrency
63
///
64
/// @brief Single producer multiple consumers queue.
65
///
66
/// @see @ref scripts/docs/en/userver/synchronization.md
67
template
<
typename
T>
68
using
SpmcQueue
= GenericQueue<T, impl::SimpleQueuePolicy<
false
,
true
>>;
69
70
/// @ingroup userver_concurrency
71
///
72
/// @brief Single producer single consumer queue.
73
///
74
/// @see @ref scripts/docs/en/userver/synchronization.md
75
template
<
typename
T>
76
using
SpscQueue
= GenericQueue<T, impl::SimpleQueuePolicy<
false
,
false
>>;
77
78
/// @ingroup userver_concurrency
79
///
80
/// @brief Like @ref concurrent::NonFifoMpscQueue, but does not support setting max size and is thus slightly faster.
81
///
82
/// @see @ref scripts/docs/en/userver/synchronization.md
83
template
<
typename
T>
84
using
UnboundedNonFifoMpscQueue
= GenericQueue<T, impl::NoMaxSizeQueuePolicy<
true
,
false
>>;
85
86
/// @ingroup userver_concurrency
87
///
88
/// @brief Like @ref concurrent::SpmcQueue, but does not support setting max size and is thus slightly faster.
89
///
90
/// @see @ref scripts/docs/en/userver/synchronization.md
91
template
<
typename
T>
92
using
UnboundedSpmcQueue
= GenericQueue<T, impl::NoMaxSizeQueuePolicy<
false
,
true
>>;
93
94
/// @ingroup userver_concurrency
95
///
96
/// @brief Like @ref concurrent::SpscQueue, but does not support setting max size and is thus slightly faster.
97
///
98
/// @see @ref scripts/docs/en/userver/synchronization.md
99
template
<
typename
T>
100
using
UnboundedSpscQueue
= GenericQueue<T, impl::NoMaxSizeQueuePolicy<
false
,
false
>>;
101
102
/// @ingroup userver_concurrency
103
///
104
/// @brief Single producer single consumer queue of std::string which is bounded by the total bytes inside the strings.
105
///
106
/// @see @ref scripts/docs/en/userver/synchronization.md
107
using
StringStreamQueue
= GenericQueue<std::string, impl::ContainerQueuePolicy<
false
,
false
>>;
108
109
/// @brief Consumer of @ref concurrent::StringStreamQueue.
110
using
StringStreamQueueConsumer
=
111
Consumer
<
StringStreamQueue
, impl::NoToken, impl::QueueEmplaceEnabler<
StringStreamQueue
>>;
112
113
}
// namespace concurrent
114
115
USERVER_NAMESPACE_END
userver
concurrent
queue_fwd.hpp
Generated on
for userver by
Doxygen
1.17.0