Repository navigation
This release fixes several concurrency edge cases in mpsc::MessageQueue and makes the CMake package header-only and safe to embed in other projects.
Fixes
- Consistent statistics from any thread (#23):
occupiedSlots(),emptySlots(),isEmpty()andisFull()now read both positions as a validated snapshot. They retry if the consumer moves the read position mid-read, and they report empty rather than a wrapped-around count if the snapshot is stale. Before this, a thread reading these values while the consumer was dequeuing could see inconsistent results. drain()is now bounded (#22):drain()discards only the messages present when it is called. Before, it could keep discarding indefinitely while producers kept enqueuing. Messages enqueued during a drain are not guaranteed to be discarded, and the documentation now says so.- Write overflow assertion (#21): Debug builds now assert if a writer callback reports writing more bytes than the slot holds.
Build and packaging
- Header-only CMake target (#24):
CXXMessageQueueis now anINTERFACElibrary. It requirescxx_std_20throughtarget_compile_features, so consumers get C++20 automatically. The exported target ismpsc::MessageQueue. - CMake 3.21 or later is now required (#24), up from 3.15.
- Options renamed with a project prefix (#24, #27):
BUILD_TESTING→CXXMESSAGEQUEUE_BUILD_TESTING(defaults to on only when this is the top-level project)BUILD_BENCHMARK→CXXMESSAGEQUEUE_BUILD_BENCHMARK(defaults to off)
- The CMake project version now matches the release (0.2.3) (#26).
- Warning flags (
-Wall -Wextra//W4) now apply only to the test and benchmark targets, not to code that uses the library (#24). - The install step now copies only the
mpsc/header directory (#24). - Swift Package Manager:
NDEBUGis now defined for release builds, so assertions are compiled out (#19).
Other
- Cleaned up includes: added
<cassert>,<cstddef>and<ranges>; removed the unused<limits>and<optional>(#20). - Minor reformatting (#18).
- Expanded tests, including a statistics observer racing the consumer and concurrent tests that run real traffic (#25).
Upgrading
If your CMake build sets BUILD_TESTING or BUILD_BENCHMARK for this project, switch to CXXMESSAGEQUEUE_BUILD_TESTING and CXXMESSAGEQUEUE_BUILD_BENCHMARK. Make sure your CMake is 3.21 or newer. The C++ API is unchanged.
Full Changelog: 0.2.2...0.2.3