| 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) { |