Skip to content

Commit 1d01c7a

Browse files
committed
clarify where to release the GIL
1 parent 1f7f37f commit 1d01c7a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/random.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
//!
1717
//! let random_number = Python::with_gil(|py| -> PyResult<_> {
1818
//! let mut bitgen = default_bit_gen(py)?.lock()?;
19-
//! Ok(bitgen.next_uint64())
19+
//! // use bitgen without holding the GIL
20+
//! Ok(py.allow_threads(|| bitgen.next_uint64()))
2021
//! })?;
2122
//! # Ok::<(), PyErr>(())
2223
//! ```

0 commit comments

Comments
 (0)