pub fn hold_gil_for_test(delay_secs: f64, hold_secs: f64)Expand description
Holds the GIL for the specified number of seconds without releasing it.
This is a test utility function that spawns a background thread which acquires the GIL using Rust’s Python::attach and holds it for the specified duration using thread::sleep. Unlike Python code which periodically releases the GIL, this function holds it continuously.
We intentionally use std::thread::sleep here (not Clock::sleep or async sleep)
because the purpose is to simulate a blocking operation that holds the GIL without
releasing it. Using an async sleep would release the GIL periodically, defeating
the purpose of this test utility.
Args: delay_secs: Seconds to wait before acquiring the GIL hold_secs: Seconds to hold the GIL