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

Function get_all_current_frames

crates/vm/src/stdlib/_thread.rs:1033–1046  ·  view source on GitHub ↗

Get all threads' current (top) frames. Used by sys._current_frames().

(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

1031
1032 /// Get all threads' current (top) frames. Used by sys._current_frames().
1033 pub fn get_all_current_frames(vm: &VirtualMachine) -> Vec<(u64, FrameRef)> {
1034 let registry = vm.state.thread_frames.lock();
1035 registry
1036 .iter()
1037 .filter_map(|(id, slot)| {
1038 let frames = slot.frames.lock();
1039 // SAFETY: the owning thread can't pop while we hold the Mutex,
1040 // so the FramePtr is valid for the duration of the lock.
1041 frames
1042 .last()
1043 .map(|fp| (*id, unsafe { fp.as_ref() }.to_owned()))
1044 })
1045 .collect()
1046 }
1047
1048 /// Called after fork() in child process to mark all other threads as done.
1049 /// This prevents join() from hanging on threads that don't exist in the child.

Callers 1

_current_framesFunction · 0.85

Calls 7

collectMethod · 0.80
lockMethod · 0.45
iterMethod · 0.45
mapMethod · 0.45
lastMethod · 0.45
to_ownedMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected