Skip to content

Fix for coroutines without suspension points - #19

Merged
iv461 merged 5 commits into
mainfrom
feature/promise_tests
Feb 19, 2026
Merged

Fix for coroutines without suspension points#19
iv461 merged 5 commits into
mainfrom
feature/promise_tests

Conversation

@iv461

@iv461 iv461 commented Feb 18, 2026

Copy link
Copy Markdown
Owner

This fixes that coroutines awaiting coroutines with a single co_return and no suspension points would never finish (#16 (comment)).
Also adds unit tests.

Since I've changed the coroutine state destruction logic, I've profiled again for memory leaks:

grafik grafik grafik grafik

In two test runs, one short (14s) and one longer (1.5m) the results remain the same, indicating no memory leaks of the coroutine state.

@iv461 iv461 added the bug Something isn't working label Feb 18, 2026
@iv461
iv461 force-pushed the feature/promise_tests branch from 7054e72 to 547e021 Compare February 18, 2026 22:56
@iv461 iv461 linked an issue Feb 18, 2026 that may be closed by this pull request
Ivo Ivanov added 2 commits February 19, 2026 01:08
…estroy the coro state manually in the outer promise dtor, but handle the case where the coroutine is not awaited (this is when we call coroutine from regular ros callbacks) explicitly: If the outer promise is destroyed, but the coroutine is not finished yet, it is not destroyed. Instead, it is later destroyed automatically by reaching the compiler-generated last coro state by continuing after the final suspend (i.e. not suspending in the final suspend).
@iv461
iv461 merged commit f92b14f into main Feb 19, 2026
3 checks passed
@iv461 iv461 changed the title Fix for coroutines without suspension points Fix for coroutines without suspention points Feb 19, 2026
@iv461 iv461 changed the title Fix for coroutines without suspention points Fix for coroutines without suspension points Feb 19, 2026
@iv461
iv461 deleted the feature/promise_tests branch February 19, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coroutines with no co_await never finish

1 participant