8000 Merge pull request #16 from connectivecpp/develop · connectivecpp/wait-queue@96ec6b5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 96ec6b5

Browse files
Merge pull request #16 from connectivecpp/develop
Merging develop to main
2 parents 4fbd6e1 + dbbfa64 commit 96ec6b5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
`wait_queue` is a multi-reader, multi-writer FIFO thread-safe wait queue (often called MPMC for multiple producer / multiple consumer) for transferring data between threads. It is templatized on the type of data passed through the queue as well as the queue container type. Data is passed with value semantics, either by copying or by moving (as opposed to a queue that transfers data by pointer or reference). The wait queue has both wait and no-wait pop semantics. A fixed size container (e.g. a `ring_span`) can be used, eliminating any and all dynamic memory management (useful in embedded or deterministic environments). Similarly, a circular buffer that only allocates on construction can be used, which eliminates dynamic memory management when pushing or popping values on or off the queue.
1818

19+
Thanks go to [Louis Langholtz](https://github.com/louis-langholtz) for adding DBC (Design by Contract) asserts and comments.
20+
1921
## Generated Documentation
2022

2123
The generated Doxygen documentation for `wait_queue` is [here](https://connectivecpp.github.io/wait-queue/).

include/queue/wait_queue.hpp

Lines changed: 6 additions & 12 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,7 @@ class wait_queue {
192192
*/
193193
wait_queue()
194194
// noexcept(std::is_nothrow_constructible<Container>::value)
195-
: m_stop_src(std::stop_source{}), m_stop_tok((*m_stop_src).get_token())
196-
{
195+
: m_stop_src(std::stop_source{}), m_stop_tok((*m_stop_src).get_token()) {
197196
assert(empty());
198197
assert(size() == size_type(0));
199198
assert(!stop_requested());
@@ -210,8 +209,7 @@ class wait_queue {
210209
*/
211210
wait_queue(std::stop_token stop_tok)
212211
// noexcept(std::is_nothrow_constructible<Container>::value)
213-
: m_stop_tok(stop_tok)
214-
{
212+
: m_stop_tok(stop_tok) {
215213
assert(empty());
216214
assert(size() == size_type(0));
217215
}
@@ -242,8 +240,7 @@ class wait_queue {
242240
wait_queue(Iter beg, Iter end)
243241
// noexcept(std::is_nothrow_constructible<Container, Iter, Iter>::value)
244242
: m_stop_src(std::stop_source{}), m_stop_tok((*m_stop_src).get_token()),
245-
m_data_queue(beg, end)
246-
{
243+
m_data_queue(beg, end) {
247244
assert(empty() == (beg == end));
248245
assert((size() == size_type(0)) == (beg == end)); // std::distance constrains beg, end.
249246
}
@@ -264,8 +261,7 @@ class wait_queue {
264261
template <typename Iter>
265262
wait_queue(std::stop_token stop_tok, Iter beg, Iter end)
266263
// noexcept(std::is_nothrow_constructible<Container, Iter, Iter>::value)
267-
: m_stop_tok(stop_tok), m_data_queue(beg, end)
268-
{
264+
: m_stop_tok(stop_tok), m_data_queue(beg, end) {
269265
assert(empty() == (beg == end));
270266
assert((size() == size_type(0)) == (beg == end)); // std::distance constrains beg, end.
271267
}
@@ -295,8 +291,7 @@ class wait_queue {
295291
wait_queue(size_type sz)
296292
// noexcept(std::is_nothrow_constructible<Container, size_type>::value)
297293
: m_stop_src(std::stop_source{}), m_stop_tok((*m_stop_src).get_token()),
298-
m_data_queue(sz)
299-
{
294+
m_data_queue(sz) {
300295
assert((sz != size_type(0)) || empty());
301296
assert((size() == size_type(0)) || (size() == sz));
302297
}
@@ -315,8 +310,7 @@ class wait_queue {
315310
*/
316311
wait_queue(std::stop_token stop_tok, size_type sz)
317312
// noexcept(std::is_nothrow_constructible<Container, size_type>::value)
318-
: m_stop_tok((*m_stop_src).get_token()), m_data_queue(sz)
319-
{
313+
: m_stop_tok((*m_stop_src).get_token()), m_data_queue(sz) {
320314
assert((sz != size_type(0)) || empty());
321315
assert((size() == size_type(0)) || (size() == sz));
322316
}

0 commit comments

Comments
 (0)
0