Skip to content

Commit 8b29b29

Browse files
Pulling everything together
1 parent 2ffdbae commit 8b29b29

3 files changed

Lines changed: 72 additions & 5 deletions

File tree

‎.github/workflows/build_run_unit_test_cmake.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: create-build-dir
2727
run: mkdir build
2828
- name: configure-cmake
29-
run: cd build && cmake -D WAIT_QUEUE_BUILD_TESTS:BOOL=OFF -D JM_CIRCULAR_BUFFER_BUILD_TESTS:BOOL=OFF ../main/wait-queue
29+
run: cd build && cmake -D WAIT_QUEUE_BUILD_TESTS:BOOL=ON -D JM_CIRCULAR_BUFFER_BUILD_TESTS:BOOL=OFF ../main/wait-queue
3030
- name: build
3131
run: cd build && cmake --build . --config $BUILD_TYPE
3232
- name: run-unit-test

‎README.md‎

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,69 @@
1-
# wait-queue
2-
Multiple producer / multiple consumer (MPMC) thread-safe queue for passing data between threads
1+
# `wait-queue` is a header-only C++ 20 MPMC (multiple producer / multiple consumer) thread-safe queue for passing data between threads.
2+
3+
# Unit Test and Documentation Generation Workflow Status
4+
5+
![GH Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/connectivecpp/wait-queue/build_run_unit_test_cmake.yml?branch=main&label=GH%20Actions%20build,%20unit%20tests%20on%20main)
6+
7+
![GH Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/connectivecpp/wait-queue/build_run_unit_test_cmake.yml?branch=develop&label=GH%20Actions%20build,%20unit%20tests%20on%20develop)
8+
9+
![GH Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/connectivecpp/wait-queue/gen_docs.yml?branch=main&label=GH%20Actions%20generate%20docs)
10+
11+
# Overview
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.
14+
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+
17+
`wait_queue` is inspired by code from Anthony Williams' Concurrency in Action book, although heavily modified.
18+
19+
Additional documentation can be found dkfjlkjdlkjklj
20+
21+
# Generated Documentation
22+
23+
The generated Doxygen documentation for `wait_queue` is [here](https://connectivecpp.github.io/presentations/).
24+
25+
# Dependencies
26+
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+
29+
# C++ Standard
30+
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+
33+
# Supported Compilers
34+
35+
Continuous integration workflows build and unit test on g++ (through Ubuntu), MSVC (through Windows), and clang (through macOS).
36+
37+
# Unit Test Dependencies
38+
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+
41+
The unit test uses two third-party libraries (each is a single header-only file):
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)
45+
46+
Specific versions and / or branches for the dependencies are in `test/CMakeLists.txt`.
47+
48+
# Build and Run Unit Tests
49+
50+
To build and run the unit test program:
51+
52+
First clone the `wait-queue` repository, then create a build directory in parallel to the presentations directory (this is called "out of source" builds, which is recommended), then `cd` (change directory) into the build directory. The CMake commands:
53+
54+
```
55+
cmake -D WAIT_QUEUE_BUILD_TESTS:BOOL=ON -D JM_CIRCULAR_BUFFER_BUILD_TESTS:BOOL=OFF ../wait-queue
56+
57+
cmake --build .
58+
59+
ctest
60+
```
61+
62+
For additional test output, run the unit test individually, for example:
63+
64+
```
65+
test/wait_queue_test -s
66+
```
67+
68+
The example can be built by adding `-D WAIT_QUEUE_BUILD_EXAMPLES:BOOL=ON` to the CMake configure / generate step.
69+

‎doc/Doxyfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "Example Code From Presentations"
35+
PROJECT_NAME = "Wait Queue"
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
@@ -1061,7 +1061,7 @@ FILTER_SOURCE_PATTERNS =
10611061
# (index.html). This can be useful if you have a project on for instance GitHub
10621062
# and want to reuse the introduction page also for the doxygen output.
10631063

1064-
USE_MDFILE_AS_MAINPAGE = ../examples/README.md
1064+
USE_MDFILE_AS_MAINPAGE = ../README.md
10651065

10661066
#---------------------------------------------------------------------------
10671067
# Configuration options related to source browsing

0 commit comments

Comments
 (0)