summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2023-05-24 15:41:43 +0200
committerGitHub <noreply@github.com>2023-05-24 15:41:43 +0200
commite56695daa89b7c53a88a691f35ee9a498caffbdf (patch)
tree4d02b4422e50ec0bc0ec5b733923f64206d4abba /cli
parent0bb5bbc7a0ff7565a4c7fa4ebc8c69e02f76e6b5 (diff)
fix(napi): add napi_async_init and napi_async_destroy (#19234)
We don't have support for "AsyncContext" in "node:async_hooks" module, so these two APIs are just noops. Towards https://github.com/denoland/deno/issues/18610.
Diffstat (limited to 'cli')
-rw-r--r--cli/napi/async.rs19
1 files changed, 12 insertions, 7 deletions
diff --git a/cli/napi/async.rs b/cli/napi/async.rs
index 80d128063..48de36728 100644
--- a/cli/napi/async.rs
+++ b/cli/napi/async.rs
@@ -2,6 +2,8 @@
use deno_runtime::deno_napi::*;
+use crate::check_env;
+
#[repr(C)]
pub struct AsyncWork {
pub data: *mut c_void,
@@ -69,19 +71,22 @@ fn napi_queue_async_work(
napi_ok
}
-// TODO: Custom async operations.
-
+// NOTE: we don't support "async_hooks::AsyncContext" so these APIs are noops.
#[napi_sym::napi_sym]
fn napi_async_init(
- _env: *mut Env,
+ env: *mut Env,
_async_resource: napi_value,
_async_resource_name: napi_value,
- _result: *mut *mut (),
+ result: *mut *mut (),
) -> napi_status {
- todo!()
+ check_env!(env);
+ *result = ptr::null_mut();
+ napi_ok
}
#[napi_sym::napi_sym]
-fn napi_async_destroy(_env: *mut Env, _async_context: *mut ()) -> napi_status {
- todo!()
+fn napi_async_destroy(env: *mut Env, async_context: *mut ()) -> napi_status {
+ check_env!(env);
+ assert!(async_context.is_null());
+ napi_ok
}