Skip to content

Commit 023032c

Browse files
committed
Enhance shared memory implementation: replace platform-specific code with slick-shm library, improve race condition handling, and update documentation; version bump to 1.3.0
1 parent 74222be commit 023032c

3 files changed

Lines changed: 207 additions & 235 deletions

File tree

CHANGELOG

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
# v1.3.0 - 2026-01-30
2+
- **BREAKING CHANGE**: Replaced platform-specific shared memory implementation with slick-shm library
3+
- Removed all Windows-specific code (CreateFileMapping, MapViewOfFile, etc.)
4+
- Removed all POSIX-specific code (shm_open, mmap, etc.)
5+
- Unified shared memory implementation using slick::shm::shared_memory RAII wrapper
6+
- Code reduction: ~92 lines removed (14% reduction in queue.h)
7+
- Improved race condition handling: replaced `sleep_for(1ms)` with atomic creator flag
8+
- Added `CREATOR_FLAG_OFFSET` constant for atomic creator detection at offset 48 in header
9+
- Added comprehensive shared memory layout documentation
10+
- Simplified destructor using RAII automatic cleanup
11+
- All 22 tests pass (100% success rate)
12+
- No changes to public API - fully backward compatible at API level
13+
- Binary compatibility break: shared memory segments from previous versions are incompatible
14+
115
# v1.2.3 - 2026-01-29
216
- Initialize reserved counters for local and shared-memory queues
317
- Validate shared-memory size is power-of-two and element size matches when attaching

CMakeLists.txt

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,34 @@
11
cmake_minimum_required(VERSION 3.10)
22

33
project(slick-queue
4-
VERSION 1.2.3
4+
VERSION 1.3.0
55
DESCRIPTION "A C++ Lock-Free MPMC queue"
66
LANGUAGES CXX)
77

88
set(CMAKE_CXX_STANDARD 20)
99

10+
# Options:
11+
option(BUILD_SLICK_QUEUE_TESTS "Build tests" ON)
12+
13+
find_package(slick-shm CONFIG QUIET)
14+
15+
if (NOT slick-shm_FOUND)
16+
include(FetchContent)
17+
18+
# Disable slick-shm tests and examples
19+
set(SLICK_SHM_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
20+
set(SLICK_SHM_BUILD_TESTS OFF CACHE BOOL "" FORCE)
21+
set(SLICK_SHM_INSTALL OFF CACHE BOOL "" FORCE)
22+
FetchContent_Declare(
23+
slick-shm
24+
GIT_REPOSITORY https://github.com/SlickQuant/slick-shm.git
25+
GIT_TAG v0.1.3
26+
)
27+
FetchContent_MakeAvailable(slick-shm)
28+
else()
29+
message(STATUS "slick-shm: ${slick-shm_VERSION}")
30+
endif()
31+
1032
add_library(slick-queue INTERFACE)
1133
add_library(slick::queue ALIAS slick-queue)
1234
# For backward compatibility with older versions
@@ -19,11 +41,39 @@ target_include_directories(slick-queue INTERFACE
1941
)
2042
set_target_properties(slick-queue PROPERTIES EXPORT_NAME queue)
2143

44+
target_link_libraries(slick-queue INTERFACE slick::shm)
2245
if(UNIX AND NOT APPLE)
2346
target_link_libraries(slick-queue INTERFACE rt atomic)
2447
endif()
2548

26-
option(BUILD_SLICK_QUEUE_TESTS "Build tests" ON)
49+
target_precompile_headers(slick-queue INTERFACE
50+
<cstdint>
51+
<cstddef>
52+
<atomic>
53+
<stdexcept>
54+
<string>
55+
<cassert>
56+
<thread>
57+
<chrono>
58+
<limits>
59+
<new>
60+
)
61+
62+
if (WIN32)
63+
target_precompile_headers(slick-queue INTERFACE
64+
<windows.h>
65+
<tchar.h>
66+
)
67+
else()
68+
target_precompile_headers(slick-queue INTERFACE
69+
<sys/mman.h>
70+
<sys/stat.h>
71+
<fcntl.h>
72+
<unistd.h>
73+
<cerrno>
74+
)
75+
endif()
76+
2777
if(BUILD_SLICK_QUEUE_TESTS)
2878
enable_testing()
2979
add_subdirectory(tests)
@@ -88,4 +138,4 @@ install(EXPORT slick-queueTargets
88138
DESTINATION lib/cmake/slick-queue
89139
)
90140

91-
message(STATUS "slick-queue: ${PROJECT_VERSION}")
141+
message(STATUS "${PROJECT_NAME}: ${PROJECT_VERSION}")

0 commit comments

Comments
 (0)