Skip to content

Keep coroutine frames on the thread running the body - #2167

Merged
BCSharp merged 1 commit into
IronLanguages:mainfrom
BCSharp:async-framestack
Nov 17, 2026
Merged

BCSharp merged 1 commit into
IronLanguages:mainfrom
BCSharp:async-framestack

Conversation

@BCSharp

@BCSharp BCSharp commented Nov 16, 2026

Copy link
Copy Markdown
Member

Addresses the coroutine part (runtime async only) of, thus resolves #2133. The solution is similar to #2146: the frame is popped at suspension points, and re-applied on resume. Unlike in the generator case where suspension points are yielding back to the caller, await points are awaited forward, hence not visible to the caller. So the mechanism is diferent: it uses IObserver hook in the DLR (IronLanguages/dlr#380) to get notified about the suspenssion points and takes appropriate action. Async generator has both types of suspension points so it uses the same IObserver mechanism as the coroutine.

@slozier slozier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@BCSharp
BCSharp merged commit 19d65e8 into IronLanguages:main Nov 17, 2026
35 checks passed
@BCSharp
BCSharp deleted the async-framestack branch November 17, 2026 02:49
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.

Frame stack breaks when generators and async code finish on another thread

2 participants