diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2024-11-19 16:49:25 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-19 16:49:25 +0530 |
commit | 069bc15030225393f7d05521505316066464bdbd (patch) | |
tree | 8665758ced09dc2876aeedadffe27d2f0e181a09 /ext/ffi | |
parent | 0e2f6e38e7b93e42099f546ef2c01629964d095a (diff) |
feat(ext/node): perf_hooks.monitorEventLoopDelay() (#26905)
Fixes https://github.com/denoland/deno/issues/20961
Depends on https://github.com/denoland/deno_core/pull/965 and
https://github.com/denoland/deno_core/pull/966
Diffstat (limited to 'ext/ffi')
-rw-r--r-- | ext/ffi/dlfcn.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/ffi/dlfcn.rs b/ext/ffi/dlfcn.rs index 55909468f..26d1b71e9 100644 --- a/ext/ffi/dlfcn.rs +++ b/ext/ffi/dlfcn.rs @@ -15,6 +15,7 @@ use dlopen2::raw::Library; use serde::Deserialize; use serde_value::ValueDeserializer; use std::borrow::Cow; +use std::cell::RefCell; use std::collections::HashMap; use std::ffi::c_void; use std::rc::Rc; @@ -126,14 +127,17 @@ pub struct FfiLoadArgs { #[op2] pub fn op_ffi_load<'scope, FP>( scope: &mut v8::HandleScope<'scope>, - state: &mut OpState, + state: Rc<RefCell<OpState>>, #[serde] args: FfiLoadArgs, ) -> Result<v8::Local<'scope, v8::Value>, DlfcnError> where FP: FfiPermissions + 'static, { - let permissions = state.borrow_mut::<FP>(); - let path = permissions.check_partial_with_path(&args.path)?; + let path = { + let mut state = state.borrow_mut(); + let permissions = state.borrow_mut::<FP>(); + permissions.check_partial_with_path(&args.path)? + }; let lib = Library::open(&path).map_err(|e| { dlopen2::Error::OpeningLibraryError(std::io::Error::new( @@ -215,6 +219,7 @@ where } } + let mut state = state.borrow_mut(); let out = v8::Array::new(scope, 2); let rid = state.resource_table.add(resource); let rid_v8 = v8::Integer::new_from_unsigned(scope, rid); |