Skip to content

Introduce a shared continuation stack for coroutine resumption.#90

Merged
kovacsnador merged 1 commit into
mainfrom
dev/introduce_continuation_stack
May 9, 2026
Merged

Introduce a shared continuation stack for coroutine resumption.#90
kovacsnador merged 1 commit into
mainfrom
dev/introduce_continuation_stack

Conversation

@kovacsnador
Copy link
Copy Markdown
Owner

Summary

Introduce a shared continuation stack for coroutine resumption.

This replaces the previous parent/child continuation links with a stack head stored in SharedState. Awaited tasks now push their promise onto the shared continuation stack, and final suspension pops back to the previous continuation. TaskResumer resumes the current stack head directly instead of walking a child chain.

Changes

  • Replace PromiseBase::parent / child with a conti continuation pointer.
  • Add SharedState::conti as the type-erased continuation stack head.
  • Update task await suspension to push awaited promises onto the shared continuation stack.
  • Update final suspension to pop the completed coroutine and resume its parent continuation.
  • Simplify TaskResumer by removing child-chain traversal.
  • Switch SchedulablePromise from DoubleLinkable to SingleLinkable.
  • Update awaiter tests for the new continuation model.
  • Remove obsolete TaskResumer::FindContinuation tests.
  • Add nested co_yield coverage to validate continuation behavior across awaited yielding tasks.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 98.66% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
include/tinycoro/Promise.hpp 100.00% <100.00%> (ø)
include/tinycoro/PromiseBase.hpp 100.00% <100.00%> (ø)
include/tinycoro/PromiseSchedulable.hpp 95.00% <ø> (ø)
include/tinycoro/SharedState.hpp 100.00% <ø> (ø)
include/tinycoro/TaskAwaiter.hpp 100.00% <100.00%> (ø)
include/tinycoro/TaskResumer.hpp 100.00% <100.00%> (ø)
test/src/TaskAwaiter_test.cpp 100.00% <100.00%> (ø)
test/src/YieldValue_test.cpp 100.00% <100.00%> (ø)

... and 2 files with indirect coverage changes

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

@kovacsnador kovacsnador merged commit 69819d5 into main May 9, 2026
34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant