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

Call sync functions within tokio runtime #1242

Merged
merged 1 commit into from Aug 3, 2022
Merged

Call sync functions within tokio runtime #1242

merged 1 commit into from Aug 3, 2022

Conversation

Xaeroxe
Copy link
Contributor

@Xaeroxe Xaeroxe commented Jul 15, 2022

Currently napi will only use tokio if the function being called is declared async. This is a problem for users of napi because it means that we only have a tokio runtime in some contexts. This makes it difficult to predict if our non async code which is dependent on the tokio runtime will work or not.

In this PR I have napi enter the tokio runtime before calling synchronous functions, unless the tokio_rt feature is disabled, in which case it will just call the synchronous function.

@Brooooooklyn Brooooooklyn merged commit 94e8e54 into napi-rs:main Aug 3, 2022
h-a-n-a pushed a commit to speedy-js/napi-rs that referenced this pull request Sep 9, 2022
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.

None yet

2 participants