We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e8cd5e8 commit 0868405Copy full SHA for 0868405
src/random.rs
@@ -17,7 +17,10 @@
17
//! let random_number = Python::with_gil(|py| -> PyResult<_> {
18
//! let mut bitgen = default_bit_gen(py)?.lock()?;
19
//! // use bitgen without holding the GIL
20
-//! Ok(py.allow_threads(|| bitgen.next_uint64()))
+//! let r = py.allow_threads(|| bitgen.next_uint64())?;
21
+//! // release the lock manually while holding the GIL again
22
+//! bitgen.release(py)?;
23
+//! Ok(r)
24
//! })?;
25
//! # Ok::<(), PyErr>(())
26
//! ```
@@ -40,6 +43,7 @@
40
43
//! if bitgen.random_ratio(1, 1_000_000) {
41
44
//! println!("a sure thing");
42
45
//! }
46
47
//! Ok(())
48
49
0 commit comments