Debian Codegraph @

src/cpython/lock.rs

raw symbols SCIP
1 #[cfg(Py_3_14)]
2 use std::os::raw::c_int;
3 use std::sync::atomic::AtomicU8;
4
5 #[repr(transparent)]
6 #[derive(Debug)]
7 pub struct PyMutex {
8 pub(crate) _bits: AtomicU8,
9 }
10
11 // we don't impl Default because PyO3's safe wrappers don't need it
12 #[allow(clippy::new_without_default)]
13 impl PyMutex {
14 pub const fn new() -> PyMutex {
15 PyMutex {
16 _bits: AtomicU8::new(0),
17 }
18 }
19 }
20
21 extern "C" {
22 pub fn PyMutex_Lock(m: *mut PyMutex);
23 pub fn PyMutex_Unlock(m: *mut PyMutex);
24 #[cfg(Py_3_14)]
25 pub fn PyMutex_IsLocked(m: *mut PyMutex) -> c_int;
26 }