micoring is a fixed-capacity ring buffer for caller-owned storage.
The default build is portable single-context C99. An optional MRING_CONCURRENCY_SPSC_ATOMIC
configuration supports one producer and one consumer with release/acquire publication on
supported compiler backends. The library does not perform internal locking, does not allocate,
and does not provide pointer-borrow APIs.
- Caller-owned fixed storage
- Sized initialization with overflow checks
- Copy-based push, pop, peek, and
peek_at - Batch push/pop with exact transferred counts
- Stable public ABI based on fixed-width integers and
size_t - CMake package export and
add_subdirectorysupport
#include"mring.h"#include<stdint.h>typedefstruct {
uint16_tid;
uint16_tstate;
uint32_treading;
} sample_t;
staticuint8_tstorage[8U*sizeof(sample_t)];
staticmring_tring;
intapp_init(void)
{
returnmring_init(&ring, storage, sizeof(storage), 8U, sizeof(sample_t));
}MRING_CONCURRENCY_SINGLE_CONTEXT: default. One execution context owns one ring instance at a time. Any task/thread/ISR/core sharing requires external serialization.MRING_CONCURRENCY_SPSC_ATOMIC: optional. One producer ownspush; one consumer ownspopandpeek. Generic snapshot queries are still quiescent or externally synchronized operations.mring_push_overwrite()is not a concurrent SPSC primitive. In atomic mode it returnsMRING_ERR_UNSUPPORTED.
cmake -S . -B build -DMRING_BUILD_TESTS=ON -DMRING_CONCURRENCY_MODE=single-context
cmake --build build
ctest --test-dir buildmakeCC, CPPFLAGS, CFLAGS, and LDFLAGS are honored.
- API reference
- Cookbook
- Design notes
- Porting guide
- Troubleshooting
- Verification status
- Contributing
- Security
- Changelog
Releases are tag-based. The repository workflow only creates GitHub releases for pushed tags
matching v*; branch pushes do not create releases.