|
1 | | -# `wait-queue` is a header-only C++ 20 MPMC (multiple producer / multiple consumer) thread-safe queue for passing data between threads. |
| 1 | +# Wait Queue, a Header-Only C++ 20 MPMC Thread-Safe Queue |
2 | 2 |
|
3 | | -# Unit Test and Documentation Generation Workflow Status |
| 3 | +#### Unit Test and Documentation Generation Workflow Status |
4 | 4 |
|
5 | 5 |  |
6 | 6 |
|
7 | 7 |  |
8 | 8 |
|
9 | 9 |  |
10 | 10 |
|
11 | | -# Overview |
| 11 | +## Overview |
12 | 12 |
|
13 | | -`wait_queue` is a multi-reader, multi-writer FIFO queue 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. |
| 13 | +`wait_queue` is a multi-reader, multi-writer FIFO 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. |
14 | 14 |
|
15 | 15 | A graceful shutdown can be performed using the `request_stop` method (modeled on the C++ 20 `request_stop` from `std::stop_source`). This allows waiting reader threads to be notified for shutdown. Alternatively a `std::stop_token` can be passed in to the `wait_queue` constructor, allowing shutdown from outside of the `wait_queue` object. |
16 | 16 |
|
17 | 17 | `wait_queue` is inspired by code from Anthony Williams' Concurrency in Action book, although heavily modified. |
18 | 18 |
|
19 | 19 | Additional documentation can be found dkfjlkjdlkjklj |
20 | 20 |
|
21 | | -# Generated Documentation |
| 21 | +## Generated Documentation |
22 | 22 |
|
23 | 23 | The generated Doxygen documentation for `wait_queue` is [here](https://connectivecpp.github.io/presentations/). |
24 | 24 |
|
25 | | -# Dependencies |
| 25 | +## Dependencies |
26 | 26 |
|
27 | 27 | The `wait-queue` header file does not have any third-party dependencies. It uses C++ standard library headers only. The unit test code does have dependencies as noted below. |
28 | 28 |
|
29 | | -# C++ Standard |
| 29 | +## C++ Standard |
30 | 30 |
|
31 | 31 | `wait-queue` uses C++ 20 features, including `std::stop_token`, `std::stop_source`, `std::condition_variable_any`, `std::scoped_lock`, and `concepts` / `requires`. |
32 | 32 |
|
33 | | -# Supported Compilers |
| 33 | +## Supported Compilers |
34 | 34 |
|
35 | 35 | Continuous integration workflows build and unit test on g++ (through Ubuntu), MSVC (through Windows), and clang (through macOS). |
36 | 36 |
|
37 | | -# Unit Test Dependencies |
| 37 | +## Unit Test Dependencies |
38 | 38 |
|
39 | 39 | The unit test code uses [Catch2](https://github.com/catchorg/Catch2). If the `WAIT_QUEUE_BUILD_TESTS` flag is provided to Cmake (see commands below) the Cmake configure / generate will download the Catch2 library as appropriate using the [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) dependency manager. If Catch2 (v3 or greater) is already installed using a different package manager (such as Conan or vcpkg), the `CPM_USE_LOCAL_PACKAGES` variable can be set which results in `find_package` being attempted. Note that v3 (or later) of Catch2 is required. |
40 | 40 |
|
41 | 41 | The unit test uses two third-party libraries (each is a single header-only file): |
42 | 42 |
|
43 | | -- Martin Moene's [`ring-span-lite`](https://github.com/martinmoene/ring-span-lite) |
44 | | -- Justas Masiulis' [`circular_buffer`](https://github.com/JustasMasiulis/circular_buffer) |
| 43 | +- Martin Moene's [ring-span-lite](https://github.com/martinmoene/ring-span-lite) |
| 44 | +- Justas Masiulis' [circular_buffer](https://github.com/JustasMasiulis/circular_buffer) |
45 | 45 |
|
46 | 46 | Specific versions and / or branches for the dependencies are in `test/CMakeLists.txt`. |
47 | 47 |
|
48 | | -# Build and Run Unit Tests |
| 48 | +## Build and Run Unit Tests |
49 | 49 |
|
50 | 50 | To build and run the unit test program: |
51 | 51 |
|
|
0 commit comments