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

Function cleanup_thread_local_data

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

Clean up thread-local data for the current thread. This triggers __del__ on objects stored in thread-local variables.

()

Source from the content-addressed store, hash-verified

596 /// Clean up thread-local data for the current thread.
597 /// This triggers __del__ on objects stored in thread-local variables.
598 fn cleanup_thread_local_data() {
599 // Take all guards - this will trigger LocalGuard::drop for each,
600 // which removes the thread's dict from each Local instance
601 LOCAL_GUARDS.with(|guards| {
602 guards.borrow_mut().clear();
603 });
604 }
605
606 #[cfg(all(not(target_arch = "wasm32"), feature = "host_env"))]
607 #[pyfunction]

Callers 1

run_threadFunction · 0.85

Calls 3

withMethod · 0.80
borrow_mutMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected