diff options
Diffstat (limited to 'cli')
-rw-r--r-- | cli/napi/async.rs | 19 |
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 } |