BDE 4.39.x Production Release
Loading...
Searching...
No Matches
bdlcc.h
Go to the documentation of this file.
1
/// @file bdlcc.h
2
///
3
///
4
/// @defgroup bdlcc Package bdlcc
5
/// @brief Basic Development Library Concurrency Containers (bdlcc)
6
/// @addtogroup bdl
7
/// @{
8
/// @addtogroup bdlcc
9
/// @{
10
/// * <a href="#bdlcc-purpose"> Purpose</a>
11
/// * <a href="#bdlcc-mnemonic"> Mnemonic </a>
12
/// * <a href="#bdlcc-description"> Description </a>
13
/// * <a href="#bdlcc-hierarchical-synopsis"> Hierarchical Synopsis </a>
14
/// * <a href="#bdlcc-component-synopsis"> Component Synopsis </a>
15
/// * <a href="#bdlcc-component-overview"> Component Overview </a>
16
/// * <a href="#bdlcc-ref-bdlcc_objectcatalog"> @ref bdlcc_objectcatalog </a>
17
/// * <a href="#bdlcc-ref-bdlcc_objectpool"> @ref bdlcc_objectpool </a>
18
/// * <a href="#bdlcc-ref-bdlcc_queue"> @ref bdlcc_queue </a>
19
/// * <a href="#bdlcc-ref-bdlcc_timequeue"> @ref bdlcc_timequeue </a>
20
///
21
/// # Purpose {#bdlcc-purpose}
22
/// Provide containers that support concurrent (multi-thread) access.
23
///
24
/// # Mnemonic {#bdlcc-mnemonic}
25
/// Basic Development Library Concurrency Containers (bdlcc)
26
///
27
/// @see bdlc, bdlmt
28
///
29
/// # Description {#bdlcc-description}
30
/// The 'bdlcc' package provides a set of containers that allow
31
/// concurrent access and manipulation. Components in this package are similar in
32
/// *intent* to the corresponding 'bdlc' components, except that all operations
33
/// which change the internal state of the containers are guaranteed to be atomic
34
/// in the presence of multiple threads.
35
///
36
/// Support for true multi-threading causes some significant interface changes
37
/// when compared to the analogous 'bdlc' components. A thread-safe collection
38
/// cannot, in general, guarantee thread safety for its contained objects while
39
/// still allowing access to those objects. So, for instance, a canonical
40
/// implementation of 'operator[]', yielding a reference to the contained object,
41
/// would violate thread safety. Therefore, thread-safe collections will, in
42
/// general, return items *by* *value* rather than *by* *reference*.
43
///
44
/// In addition, thread-aware collection components must make policy decisions
45
/// regarding behavior of manipulators at the "edge conditions" when a collection
46
/// is empty or full. In a multi-threading context, it is often reasonable for a
47
/// manipulator to block if it cannot complete a requested operation, and to wait
48
/// for the collection state to change. For instance, when called for an empty
49
/// collection, 'bdlcc::Queue<T>::popFront()' will block and then wait until an
50
/// element is available to satisfy the request.
51
///
52
/// In general, components in 'bdlcc' support this blocking behavior where it
53
/// makes sense. Refer to the individual component documentation to understand
54
/// how this general principle is carried out in specific components.
55
///
56
/// Unless otherwise stated, the behavior of the destructors of components in the
57
/// 'bdlcc' package is undefined unless all access or modification of the object
58
/// is completed prior to its destruction. Some form of synchronization, external
59
/// to the component, is required to ensure this precondition on the destructor is
60
/// met. For example, if two (or more) threads are manipulating a container, it
61
/// is *not* safe to anticipate the number of elements added to the container, and
62
/// destroy that container immediately after the last element is removed (without
63
/// additional synchronization) because one of the corresponding insert functions
64
/// may not have completed (the insert may, for instance, signal waiting threads
65
/// after the element is considered added to the container).
66
///
67
/// ## Hierarchical Synopsis {#bdlcc-hierarchical-synopsis}
68
///
69
/// The 'bdlcc' package currently has 20 components having 4 levels of physical
70
/// dependency. The list below shows the hierarchical ordering of the components.
71
/// The order of components within each level is not architecturally significant,
72
/// just alphabetical.
73
/// @code
74
/// 4. bdlcc_sharedobjectpool
75
///
76
/// 3. bdlcc_objectpool
77
///
78
/// 2. bdlcc_fixedqueue
79
/// bdlcc_singleconsumerqueue
80
/// bdlcc_singleproducerqueue
81
/// bdlcc_stripedunorderedmap
82
/// bdlcc_stripedunorderedmultimap
83
///
84
/// 1. bdlcc_boundedqueue
85
/// bdlcc_cache
86
/// bdlcc_deque
87
/// bdlcc_fixedqueueindexmanager
88
/// bdlcc_multipriorityqueue
89
/// bdlcc_objectcatalog
90
/// bdlcc_queue !DEPRECATED!
91
/// bdlcc_singleconsumerqueueimpl
92
/// bdlcc_singleproducerqueueimpl
93
/// bdlcc_singleproducersingleconsumerboundedqueue
94
/// bdlcc_skiplist
95
/// bdlcc_stripedunorderedcontainerimpl
96
/// bdlcc_timequeue
97
/// @endcode
98
///
99
/// ## Component Synopsis {#bdlcc-component-synopsis}
100
///
101
/// @ref bdlcc_boundedqueue :
102
/// Provide a thread-aware bounded queue of values.
103
///
104
/// @ref bdlcc_cache :
105
/// Provide a in-process cache with configurable eviction policy.
106
///
107
/// @ref bdlcc_deque :
108
/// Provide a fully thread-safe deque container.
109
///
110
/// @ref bdlcc_fixedqueue :
111
/// Provide a thread-aware fixed-size queue of values.
112
///
113
/// @ref bdlcc_fixedqueueindexmanager :
114
/// Provide thread-enabled state management for a fixed-size queue.
115
///
116
/// @ref bdlcc_multipriorityqueue :
117
/// Provide a thread-enabled parameterized multi-priority queue.
118
///
119
/// @ref bdlcc_objectcatalog :
120
/// Provide an efficient indexed, thread-safe object container.
121
///
122
/// @ref bdlcc_objectpool :
123
/// Provide a thread-safe object pool.
124
///
125
/// @ref bdlcc_queue : !DEPRECATED!
126
/// Provide a thread-enabled queue of items of parameterized `TYPE`.
127
///
128
/// @ref bdlcc_sharedobjectpool :
129
/// Provide a thread-safe pool of shared objects.
130
///
131
/// @ref bdlcc_singleconsumerqueue :
132
/// Provide a thread-aware single consumer queue of values.
133
///
134
/// @ref bdlcc_singleconsumerqueueimpl :
135
/// Provide a testable thread-aware single consumer queue of values.
136
///
137
/// @ref bdlcc_singleproducerqueue :
138
/// Provide a thread-aware single producer queue of values.
139
///
140
/// @ref bdlcc_singleproducerqueueimpl :
141
/// Provide a testable thread-aware single producer queue of values.
142
///
143
/// @ref bdlcc_singleproducersingleconsumerboundedqueue :
144
/// Provide a thread-aware SPSC bounded queue of values.
145
///
146
/// @ref bdlcc_skiplist :
147
/// Provide a generic thread-safe Skip List.
148
///
149
/// @ref bdlcc_stripedunorderedcontainerimpl :
150
/// Provide common implementation of *striped* un-ordered map/multimap.
151
///
152
/// @ref bdlcc_stripedunorderedmap :
153
/// Provide a bucket-group locking (i.e., *striped*) unordered map.
154
///
155
/// @ref bdlcc_stripedunorderedmultimap :
156
/// Provide a bucket-group locking (*striped*) unordered multimap.
157
///
158
/// @ref bdlcc_timequeue :
159
/// Provide an efficient queue for time events.
160
///
161
/// ## Component Overview {#bdlcc-component-overview}
162
///
163
/// This section provides a brief introduction to some of the components of the
164
/// 'bdlcc' package. Full details are available in the documentation of each
165
/// component.
166
///
167
/// ### @ref bdlcc_objectcatalog {#bdlcc-ref-bdlcc_objectcatalog}
168
///
169
/// The @ref bdlcc_objectcatalog component provides a thread-safe, indexable
170
/// catalog of object. Clients instantiate a template class,
171
/// 'bdlcc::ObjectCatalog<T>', where type 'T' is the data type of elements that
172
/// the catalog will hold. Type 'T' must be defined to be copyable either by a
173
/// copy constructor or by 'T::operator=()'; class 'bdlcc::ObjectCatalog' places
174
/// no additional requirements on 'T'.
175
///
176
/// When clients add elements to a 'bdlcc::ObjectCatalog', the 'add' method
177
/// returns a handle which can be used to refer to the element until the element
178
/// is 'remove'd. Addition is not guaranteed to succeed and the return vaslue
179
/// must be checked. An element can be accessed through its handle by using the
180
/// 'find' function and passing a buffer for holding the value. Passing a null
181
/// buffer can be used for testing whether the handle is still valid (i.e., refers
182
/// to an element that has not yet been removed from the catalog).
183
///
184
/// The 'bdlcc::ObjectCatalog' is designed to support direct access to individual
185
/// queued elements based upon their 'Handle'. This means that
186
/// 'bdlcc::ObjectCatalog' can support frequent additions and removals more
187
/// efficiently than traditional queue structures designed for sequential access.
188
///
189
/// ### @ref bdlcc_objectpool {#bdlcc-ref-bdlcc_objectpool}
190
///
191
/// The @ref bdlcc_objectpool component provides a thread-safe memory pool of
192
/// objects from a parameterized type 'T'. Clients instantiate a
193
/// 'bdlcc::ObjectPool<T>' where the type 'T' has no requirements. The pool owns
194
/// the memory and objects it contains. An object pool manages creation of its
195
/// objects via a user-installed functor (given to the pool constructor), and
196
/// provides automatic destruction of its objects either upon the 'destroyObject'
197
/// method, or upon the pool destruction. An object can be obtained from the pool
198
/// by calling the 'getObject' method, and can be released back to the pool for
199
/// further use within 'getObject' by calling the 'releaseObject' method.
200
///
201
/// An object pool is most useful when the objects are equivalent (i.e., any
202
/// object in the pool can be used to satisfy an object request) and object
203
/// creation is potentially expensive. Pooling enables the object to be reused at
204
/// a later time without going through destruction and re-creation. For instance,
205
/// the object constructor may get access to some resource (e.g., a connection)
206
/// and the resource may remain valid after several uses and thus can be reused.
207
///
208
/// ### @ref bdlcc_queue {#bdlcc-ref-bdlcc_queue}
209
///
210
/// The @ref bdlcc_queue component provides an in-place, indexable, double-ended
211
/// queue. Clients instantiate a template class, 'bdlcc::Queue<T>', where type
212
/// 'T' is the data type of elements that the queue will hold. Type 'T' must be
213
/// defined to be copyable either by a copy constructor or by 'T::operator=()';
214
/// class 'bdlcc::Queue' Places no additional requirements on 'T'.
215
///
216
/// ### @ref bdlcc_timequeue {#bdlcc-ref-bdlcc_timequeue}
217
///
218
/// The @ref bdlcc_timequeue component provides an in-place, indexable queue,
219
/// managed in time order. Clients instantiate a template class,
220
/// 'bdlcc::TimeQueue<T>', where type 'T' is the data type of elements that the
221
/// queue will hold. Type 'T' must be defined to be copyable either by a copy
222
/// constructor or by 'T::operator=()'; class 'bdlcc::TimeQueue' places no
223
/// additional requirements on 'T'.
224
///
225
/// When clients add elements to a 'bdlcc::TimeQueue', they provide both the
226
/// element 'T' to be added and a time value, of type 'bsls::TimeInterval'.
227
/// Elements can be extracted individually in time order using the overloaded
228
/// 'popFront()' member functions; a block of elements can also be popped in a
229
/// single operation, 'popLE()', which pops all elements before a given time
230
/// value.
231
///
232
/// The 'bdlcc::TimeQueue' class template supports direct access to individual
233
/// queued elements based upon their 'Handle'. This means that 'bdlcc::TimeQueue'
234
/// can support frequent additions and removals more efficiently than traditional
235
/// queue structures designed for sequential access.
236
///
237
/// @}
238
/** @} */
doxygen_input
bde
groups
bdl
bdlcc
doc
bdlcc.h
Generated by
1.9.8