MCPcopy Create free account
hub / github.com/PyO3/rust-numpy / borrows_span_threads

Function borrows_span_threads

tests/borrow.rs:114–134  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

112
113#[test]
114fn borrows_span_threads() {
115 Python::attach(|py| {
116 let array = PyArray::<f64, _>::zeros(py, (1, 2, 3), false);
117
118 let _exclusive = array.readwrite();
119
120 let array = array.unbind();
121
122 py.detach(move || {
123 let thread = spawn(move || {
124 Python::attach(|py| {
125 let array = array.bind(py);
126
127 let _exclusive = array.readwrite();
128 });
129 });
130
131 assert!(thread.join().is_err());
132 });
133 });
134}
135
136#[test]
137fn shared_borrows_can_be_cloned() {

Callers

nothing calls this directly

Calls 2

zerosFunction · 0.85
readwriteMethod · 0.80

Tested by

no test coverage detected