mres_platform_t platform = { .context = NULL, .clock = app_clock, .wait = app_wait };mres_retry_policy_t policy = { 3u, MRES_BACKOFF_FIXED, 0u, 0u, 100u, 0u };mres_retry_policy_t policy = { 4u, MRES_BACKOFF_LINEAR, 0u, 0u, 50u, 250u };mres_retry_policy_t policy = { 5u, MRES_BACKOFF_EXPONENTIAL, 0u, 0u, 25u, 500u };mres_retry_init(&retry, &policy);
mres_retry_seed(&retry, 1234u);uint32_t delay_ms = 0u;
mres_delay_calc(&retry, attempt, &delay_ms);Check for MRES_ERR_WAIT_REQUIRED when a policy can compute positive delays and no wait callback is available.
Use mres_breaker_get_state and mres_breaker_remaining_ms to inspect state explicitly.
Use manual success and failure reports only when no breaker call is active and the caller can associate the result with the current breaker generation.
mres_ratelimit_acquire returns MRES_OK and allowed == false when the limiter is temporarily empty.
Use mres_ratelimit_tokens to query the post-refill token count.
Simulate wrap with a test clock that advances from values near UINT32_MAX to small values after wrap.
Use two retry or breaker instances rather than sharing one instance between unrelated operations.
Lock around the entire call and its callbacks when multiple tasks share one instance.
See tests/consumers/find_package.
See tests/consumers/add_subdirectory.
The repository includes C++11, C++17, and C++20 consumer fixtures.
Retry remains synchronous. A main loop that cannot block should compute delays and schedule its own later retry.
Retry and breaker callbacks may block and may execute arbitrary application code, so this repo does not claim ISR safety for them.
If the process aborts, resets, faults, or loses power, in-memory retry, breaker, and limiter state is lost immediately.