summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/napi/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/napi/lib.rs b/ext/napi/lib.rs
index 1cb1b7c26..a304a8818 100644
--- a/ext/napi/lib.rs
+++ b/ext/napi/lib.rs
@@ -533,7 +533,8 @@ pub fn init<P: NapiPermissions + 'static>(unstable: bool) -> Extension {
maybe_scheduling = true;
}
- for (_id, counter) in napi_state.tsfn_ref_counters.borrow().iter() {
+ let tsfn_ref_counters = napi_state.tsfn_ref_counters.borrow().clone();
+ for (_id, counter) in tsfn_ref_counters.iter() {
if counter.load(std::sync::atomic::Ordering::SeqCst) > 0 {
maybe_scheduling = true;
break;