Skip to content

Commit

Permalink
comments from review
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Oct 4, 2024
1 parent 9616969 commit f575502
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 35 deletions.
34 changes: 0 additions & 34 deletions pyo3-ffi/src/cpython/critical_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,47 +9,13 @@ pub struct PyCriticalSection {
_cs_mutex: *mut PyMutex,
}

#[cfg(Py_GIL_DISABLED)]
impl PyCriticalSection {
pub const fn new() -> PyCriticalSection {
PyCriticalSection {
_cs_prev: 0,
_cs_mutex: std::ptr::null_mut(),
}
}
}

#[cfg(Py_GIL_DISABLED)]
impl Default for PyCriticalSection {
fn default() -> Self {
PyCriticalSection::new()
}
}

#[repr(C)]
#[cfg(Py_GIL_DISABLED)]
pub struct PyCriticalSection2 {
_cs_base: PyCriticalSection,
_cs_mutex2: *mut PyMutex,
}

#[cfg(Py_GIL_DISABLED)]
impl PyCriticalSection2 {
pub const fn new() -> PyCriticalSection2 {
PyCriticalSection2 {
_cs_base: PyCriticalSection::new(),
_cs_mutex2: std::ptr::null_mut(),
}
}
}

#[cfg(Py_GIL_DISABLED)]
impl Default for PyCriticalSection2 {
fn default() -> Self {
PyCriticalSection2::new()
}
}

#[cfg(not(Py_GIL_DISABLED))]
opaque_struct!(PyCriticalSection);

Expand Down
2 changes: 1 addition & 1 deletion src/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl Interned {
/// until the closure `f` is finished.
///
/// This is structurally equivalent to the use of the paired
/// Py_BEGIN_CRITICAL_SECTION and Py_END_CRITICAL_SECTION macros.
/// Py_BEGIN_CRITICAL_SECTION and Py_END_CRITICAL_SECTION C-API macros.
///
/// A no-op on GIL-enabled builds, where the critical section API is exposed as
/// a no-op by the Python C API.
Expand Down

0 comments on commit f575502

Please sign in to comment.