mirror of
https://github.com/denoland/deno.git
synced 2025-01-21 21:50:00 -05:00
fix(napi): don't hold on to borrow during iteration (#17461)
I mistakenly held on to a RefCell's borrow for the whole time of iteration, but since these counters can be refed/unrefed from any thread that is a mistake.
This commit is contained in:
parent
69ec45eac7
commit
f1b275ed6b
1 changed files with 2 additions and 1 deletions
|
@ -533,7 +533,8 @@ pub fn init<P: NapiPermissions + 'static>(unstable: bool) -> Extension {
|
||||||
maybe_scheduling = true;
|
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 {
|
if counter.load(std::sync::atomic::Ordering::SeqCst) > 0 {
|
||||||
maybe_scheduling = true;
|
maybe_scheduling = true;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue