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

fix: Fix Promise::awaitFuture actually locking threads #347

Merged
merged 3 commits into from
Nov 18, 2024
Merged

Conversation

mrousavy
Copy link
Owner

Fixes an issue where the new Promise<T> implementation introduced in 8832bc5 actually caused a thread-lock since std::future was still used. This caused the future to be awaited on the JS thread instead of the background thread, making promises resolve synchronously instead of asynchronously.

The issue was caused by std::future/std::shared_future's RAII mechanism where the destructor waits for the task to complete. Now, it is moved to a shared_ptr and only awaited for completion in the run function.

@mrousavy mrousavy marked this pull request as ready for review November 18, 2024 23:50
Copy link

vercel bot commented Nov 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
nitro-docs ⬜️ Skipped (Inspect) Nov 18, 2024 11:52pm

@mrousavy mrousavy merged commit 8cd7a29 into main Nov 18, 2024
2 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