@@ -148,35 +148,35 @@ fn kind() -> Kind {
148148}
149149
150150pub struct ReentrantMutex {
151- inner : UnsafeCell < MaybeUninit < c:: CRITICAL_SECTION > > ,
151+ inner : MaybeUninit < UnsafeCell < c:: CRITICAL_SECTION > > ,
152152}
153153
154154unsafe impl Send for ReentrantMutex { }
155155unsafe impl Sync for ReentrantMutex { }
156156
157157impl ReentrantMutex {
158158 pub const fn uninitialized ( ) -> ReentrantMutex {
159- ReentrantMutex { inner : UnsafeCell :: new ( MaybeUninit :: uninit ( ) ) }
159+ ReentrantMutex { inner : MaybeUninit :: uninit ( ) }
160160 }
161161
162162 pub unsafe fn init ( & self ) {
163- c:: InitializeCriticalSection ( ( & mut * self . inner . get ( ) ) . as_mut_ptr ( ) ) ;
163+ c:: InitializeCriticalSection ( UnsafeCell :: raw_get ( self . inner . as_ptr ( ) ) ) ;
164164 }
165165
166166 pub unsafe fn lock ( & self ) {
167- c:: EnterCriticalSection ( ( & mut * self . inner . get ( ) ) . as_mut_ptr ( ) ) ;
167+ c:: EnterCriticalSection ( UnsafeCell :: raw_get ( self . inner . as_ptr ( ) ) ) ;
168168 }
169169
170170 #[ inline]
171171 pub unsafe fn try_lock ( & self ) -> bool {
172- c:: TryEnterCriticalSection ( ( & mut * self . inner . get ( ) ) . as_mut_ptr ( ) ) != 0
172+ c:: TryEnterCriticalSection ( UnsafeCell :: raw_get ( self . inner . as_ptr ( ) ) ) != 0
173173 }
174174
175175 pub unsafe fn unlock ( & self ) {
176- c:: LeaveCriticalSection ( ( & mut * self . inner . get ( ) ) . as_mut_ptr ( ) ) ;
176+ c:: LeaveCriticalSection ( UnsafeCell :: raw_get ( self . inner . as_ptr ( ) ) ) ;
177177 }
178178
179179 pub unsafe fn destroy ( & self ) {
180- c:: DeleteCriticalSection ( ( & mut * self . inner . get ( ) ) . as_mut_ptr ( ) ) ;
180+ c:: DeleteCriticalSection ( UnsafeCell :: raw_get ( self . inner . as_ptr ( ) ) ) ;
181181 }
182182}
0 commit comments