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

Function _on_fork

crates/stdlib/src/_asyncio.rs:2560–2569  ·  view source on GitHub ↗
(vm: &VirtualMachine)

Source from the content-addressed store, hash-verified

2558 /// Reset task state after fork in child process.
2559 #[pyfunction]
2560 fn _on_fork(vm: &VirtualMachine) -> PyResult<()> {
2561 // Clear current_tasks dict so child process doesn't inherit parent's tasks
2562 if let Ok(current_tasks) = get_current_tasks_dict(vm) {
2563 vm.call_method(&current_tasks, "clear", ())?;
2564 }
2565 // Clear the running loop and task
2566 *vm.asyncio_running_loop.borrow_mut() = None;
2567 *vm.asyncio_running_task.borrow_mut() = None;
2568 Ok(())
2569 }
2570
2571 #[pyfunction]
2572 fn future_add_to_awaited_by(

Callers

nothing calls this directly

Calls 3

get_current_tasks_dictFunction · 0.85
borrow_mutMethod · 0.80
call_methodMethod · 0.45

Tested by

no test coverage detected