1#[cfg(Py_3_14)]
2use std::os::raw::c_int;
3use std::sync::atomic::AtomicU8;
4
5#[repr(transparent)]
6#[derive(Debug)]
7pub struct PyMutex {
8 pub(crate) _bits: AtomicU8,
9}
10
11#[allow(clippy::new_without_default)]
13impl PyMutex {
14 pub const fn new() -> PyMutex {
15 PyMutex {
16 _bits: AtomicU8::new(0),
17 }
18 }
19}
20
21extern "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}