Introduction
The arrp (Auto Returning Resource Pool) library provides a thread-safe, modern C++20 resource pool implementation with automatic lifecycle management using RAII principles.
This header-only library eliminates boilerplate resource management code and provides a simple, type-safe API for resource pooling scenarios. Perfect for managing expensive-to-create resources like database connections, thread pools, or network sockets.
Key Features
- Thread-Safe: All operations protected by mutexes for concurrent access
- RAII Pattern: Automatic resource return via scoped_resource wrapper
- Capacity Management: Enforces maximum capacity limits
- FIFO Ordering: Predictable resource ordering
- Customizable Factory: Support for custom resource creation callbacks
- Exception Safe: Strong exception guarantees with automatic cleanup
- Modern C++20: Uses only standard library features
- Type-Safe: Leverages C++20 concepts for compile-time type checking
- Move Semantics: Efficient resource transfer with perfect forwarding
- JSON Diagnostics: Optional JSON serialization for pool state monitoring
Documentation
Installation
Using CMake (Recommended)
include(FetchContent)
FetchContent_Declare(arrp
GIT_REPOSITORY https://github.com/SiddiqSoft/arrp.git
GIT_TAG main
)
FetchContent_MakeAvailable(arrp)
target_link_libraries(your_target PRIVATE arrp::arrp)
Using NuGet (Windows)
nuget install SiddiqSoft.aarp
Manual Integration
Simply include the header files from include/siddiqsoft/ in your project.
License
BSD 3-Clause License - See LICENSE file for details
Copyright
Copyright (c) 2026, Abdulkareem Siddiq. All rights reserved.
Links
See Also