rust/hg-cpython/src/ref_sharing.rs
changeset 43175 a1908eb08342
parent 43174 1c675c5fe5fe
child 43176 aaec70a5f9a8
equal deleted inserted replaced
43174:1c675c5fe5fe 43175:a1908eb08342
    31 pub struct PySharedState {
    31 pub struct PySharedState {
    32     leak_count: Cell<usize>,
    32     leak_count: Cell<usize>,
    33     mutably_borrowed: Cell<bool>,
    33     mutably_borrowed: Cell<bool>,
    34 }
    34 }
    35 
    35 
       
    36 // &PySharedState can be Send because any access to inner cells is
       
    37 // synchronized by the GIL.
       
    38 unsafe impl Sync for PySharedState {}
       
    39 
    36 impl PySharedState {
    40 impl PySharedState {
    37     pub fn borrow_mut<'a, T>(
    41     pub fn borrow_mut<'a, T>(
    38         &'a self,
    42         &'a self,
    39         py: Python<'a>,
    43         py: Python<'a>,
    40         pyrefmut: RefMut<'a, T>,
    44         pyrefmut: RefMut<'a, T>,