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

Function acquire_shared

src/borrow/shared.rs:45–57  ·  view source on GitHub ↗
(flags: *mut c_void, array: *mut PyArrayObject)

Source from the content-addressed store, hash-verified

43// These are the entry points which implement the shared borrow checking API:
44
45unsafe extern "C" fn acquire_shared(flags: *mut c_void, array: *mut PyArrayObject) -> c_int {
46 // SAFETY: must be attached when calling `acquire_shared`.
47 let py = Python::assume_attached();
48 let flags = &*(flags as *mut BorrowFlags);
49
50 let address = base_address(py, array);
51 let key = borrow_key(py, array);
52
53 match flags.acquire(address, key) {
54 Ok(()) => 0,
55 Err(()) => -1,
56 }
57}
58
59unsafe extern "C" fn acquire_mut_shared(flags: *mut c_void, array: *mut PyArrayObject) -> c_int {
60 if (*array).flags & NPY_ARRAY_WRITEABLE == 0 {

Callers

nothing calls this directly

Calls 3

base_addressFunction · 0.85
borrow_keyFunction · 0.85
acquireMethod · 0.80

Tested by

no test coverage detected