-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Deno FFI: Support async function calls #11673
Comments
@piscisaureus do you have an opinion on this one? I think we might somehow shim it using https://github.com/littledivy/deno_bindgen |
Non blocking was implemented in 1.15. https://deno.land/[email protected]/runtime/ffi_api#non-blocking-ffi btw here's how to use it with // src/lib.rs
#[deno_bindgen(non_blocking)]
fn sleep(ms: u64) {
let duration = std::time::Duration::from_millis(ms);
std::thread::sleep(duration);
} // main.ts
import { sleep } from "./bindings/bindings.ts";
await sleep(100); |
@rracariu does the non blocking option solve the issue for you? |
Yes, it does. |
Is there any way to use 'await' inside a non_blocking async ffi call? for example boiler plate mongo db connection here:
|
The FFI interface should allow calling functions asynchronously.
This would be necessary as plugin interface allowed defining such async Ops, and in general this would be required in most cases where calling an function might block the event loop.
Some initial ideas in #11152 (comment)
The text was updated successfully, but these errors were encountered: