diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2021-10-05 18:20:00 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-05 14:50:00 +0200 |
commit | 80aee99c9e2eba879a0981235bee740088c6fbad (patch) | |
tree | 68fd3a256b1900f141c105b1ab051eded2e95a6c /ext/ffi/00_ffi.js | |
parent | f1d3a170430501b4fab1a2d2abb5d77528251c77 (diff) |
feat(ext/ffi): Non-blocking FFI (#12274)
Diffstat (limited to 'ext/ffi/00_ffi.js')
-rw-r--r-- | ext/ffi/00_ffi.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/ext/ffi/00_ffi.js b/ext/ffi/00_ffi.js index 553ea1dd3..c7fdd0e8c 100644 --- a/ext/ffi/00_ffi.js +++ b/ext/ffi/00_ffi.js @@ -13,8 +13,15 @@ this.#rid = core.opSync("op_ffi_load", { path, symbols }); for (const symbol in symbols) { - this.symbols[symbol] = (...parameters) => - core.opSync("op_ffi_call", { rid: this.#rid, symbol, parameters }); + this.symbols[symbol] = symbols[symbol].nonblocking + ? (...parameters) => + core.opAsync("op_ffi_call_nonblocking", { + rid: this.#rid, + symbol, + parameters, + }) + : (...parameters) => + core.opSync("op_ffi_call", { rid: this.#rid, symbol, parameters }); } } |