Skip to content

Timer, Custom Clock/WaitTraits - #333

Merged
sgerbino merged 3 commits into
cppalliance:developfrom
sgerbino:pr/timer-single-waiter
Aug 6, 2026
Merged

Timer, Custom Clock/WaitTraits#333
sgerbino merged 3 commits into
cppalliance:developfrom
sgerbino:pr/timer-single-waiter

Conversation

@sgerbino

@sgerbino sgerbino commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Add a delay overload accepting a time point on any clock, with a
wait-traits policy controlling how much of the remaining time each
underlying steady wait may cover:

    co_await delay(system_clock::now() + 5min);
    co_await delay<capped_traits>(deadline);

The wait is zero-alloc: a sequence of re-armed steady-clock waits on
one frame-embedded waiter. waiter_node gains a re-arm hook consulted
by the completion op before resuming, and clock_delay_awaitable
re-publishes its waiter with the next traits-capped expiry until
Clock::now() reaches the deadline. Publication goes through a new
timer::publish_wait entry point with no elapsed fast path, so every
completion (including cancellation) reaches the hook; re-arms go
through timer::rearm_wait, which preserves the wait's work count and
stop callback. Steady-clock time points, of any duration type, keep
routing to the existing single-wait awaitable.

The new public header wait_traits.hpp provides the identity default
traits and the WaitTraits concept. The timers guide gains a section
on delaying against a different clock.
@cppalliance-bot

Copy link
Copy Markdown

An automated preview of the documentation is available at https://333.corosio.prtest3.cppalliance.org/index.html

If more commits are pushed to the pull request, the docs will rebuild at the same URL.

2026-08-06 12:38:57 UTC

@cppalliance-bot

Copy link
Copy Markdown

GCOVR code coverage report https://333.corosio.prtest3.cppalliance.org/gcovr/index.html
LCOV code coverage report https://333.corosio.prtest3.cppalliance.org/genhtml/index.html
Coverage Diff Report https://333.corosio.prtest3.cppalliance.org/diff-report/index.html

Build time: 2026-08-06 12:54:52 UTC

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.81%. Comparing base (0942d67) to head (d18e6a7).

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #333      +/-   ##
===========================================
- Coverage    79.97%   79.81%   -0.16%     
===========================================
  Files           96       96              
  Lines         6012     5946      -66     
  Branches      1234     1213      -21     
===========================================
- Hits          4808     4746      -62     
+ Misses         856      852       -4     
  Partials       348      348              
Files with missing lines Coverage Δ
include/boost/corosio/detail/timer_service.hpp 89.63% <ø> (-1.00%) ⬇️
src/corosio/src/timer.cpp 100.00% <ø> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0942d67...d18e6a7. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sgerbino
sgerbino merged commit 82e8c00 into cppalliance:develop Aug 6, 2026
85 of 86 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Beast2 Aug 6, 2026
@sgerbino
sgerbino deleted the pr/timer-single-waiter branch August 6, 2026 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants