Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stack safety for Task via microtasks suspension #1591

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

mikearnaldi
Copy link
Contributor

@mikearnaldi mikearnaldi commented Sep 25, 2021

We can improve the stack safety of tasks by forcing suspension of otherwise sync closure calls.

The suspension mechanism used to trampoline a thunk f is Promise.resolve().then(f) that uses microtasks (higher priority compared to setTimeout's)

Effectively closes #1177 for async tasks.

@mikearnaldi mikearnaldi marked this pull request as draft September 25, 2021 11:41
@mikearnaldi mikearnaldi marked this pull request as ready for review September 25, 2021 11:41
@mikearnaldi mikearnaldi changed the title feat: improving Task safety using microtasks Stack safety for Task via microtasks suspension Sep 25, 2021
@gcanti gcanti merged commit b896deb into gcanti:master Sep 27, 2021
@imcotton imcotton mentioned this pull request Dec 10, 2021
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.

Call stack size exception with 5500 elements
3 participants