| 1 | #[cfg (Py_GIL_DISABLED)] |
| 2 | mod atomic_c_ulong { |
| 3 | pub struct GetAtomicCULong<const WIDTH: usize>(); |
| 4 | |
| 5 | pub trait AtomicCULongType { |
| 6 | type Type; |
| 7 | } |
| 8 | impl AtomicCULongType for GetAtomicCULong<32> { |
| 9 | type Type = std::sync::atomic::AtomicU32; |
| 10 | } |
| 11 | impl AtomicCULongType for GetAtomicCULong<64> { |
| 12 | type Type = std::sync::atomic::AtomicU64; |
| 13 | } |
| 14 | |
| 15 | pub type TYPE = |
| 16 | <GetAtomicCULong<{ std::mem::size_of::<std::os::raw::c_ulong>() * 8 }> as AtomicCULongType>::Type; |
| 17 | } |
| 18 | |
| 19 | /// Typedef for an atomic integer to match the platform-dependent c_ulong type. |
| 20 | #[cfg (Py_GIL_DISABLED)] |
| 21 | #[doc (hidden)] |
| 22 | pub type AtomicCULong = atomic_c_ulong::TYPE; |
| 23 | |