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

Method decrement_thread_countdown

crates/vm/src/vm/mod.rs:243–253  ·  view source on GitHub ↗
(&self, n: u64)

Source from the content-addressed store, hash-verified

241
242 #[inline]
243 fn decrement_thread_countdown(&self, n: u64) {
244 if n == 0 {
245 return;
246 }
247 let n = (n.min(i64::MAX as u64)) as i64;
248 let prev = self.thread_countdown.fetch_sub(n, Ordering::AcqRel);
249 if prev <= n {
250 // Clamp at 0 for safety in case of duplicate notifications.
251 self.thread_countdown.store(0, Ordering::Release);
252 }
253 }
254
255 /// Try to CAS detached threads directly to SUSPENDED and check whether
256 /// stop countdown reached zero after parking detached threads.

Callers 3

notify_suspendedMethod · 0.80
park_detached_threadsMethod · 0.80
notify_thread_goneMethod · 0.80

Calls 2

minMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected