MCPcopy Index your code
hub / github.com/RustPython/RustPython / init_thread_countdown

Method init_thread_countdown

crates/vm/src/vm/mod.rs:226–240  ·  view source on GitHub ↗
(&self, vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

224
225 #[inline]
226 fn init_thread_countdown(&self, vm: &VirtualMachine) -> i64 {
227 let requester = self.requester.load(Ordering::Relaxed);
228 let registry = vm.state.thread_frames.lock();
229 // Keep requested/count initialization serialized with thread-slot
230 // registration (which also takes this lock), matching the
231 // HEAD_LOCK-guarded stop-the-world bookkeeping.
232 self.requested.store(true, Ordering::Release);
233 let count = registry
234 .keys()
235 .filter(|&&thread_id| thread_id != requester)
236 .count();
237 let count = (count.min(i64::MAX as usize)) as i64;
238 self.thread_countdown.store(count, Ordering::Release);
239 count
240 }
241
242 #[inline]
243 fn decrement_thread_countdown(&self, n: u64) {

Callers 1

stop_the_worldMethod · 0.80

Calls 7

loadMethod · 0.45
lockMethod · 0.45
storeMethod · 0.45
countMethod · 0.45
filterMethod · 0.45
keysMethod · 0.45
minMethod · 0.45

Tested by

no test coverage detected