@@ -148,35 +148,35 @@ fn kind() -> Kind {
148
148
}
149
149
150
150
pub struct ReentrantMutex {
151
- inner : UnsafeCell < MaybeUninit < c:: CRITICAL_SECTION > > ,
151
+ inner : MaybeUninit < UnsafeCell < c:: CRITICAL_SECTION > > ,
152
152
}
153
153
154
154
unsafe impl Send for ReentrantMutex { }
155
155
unsafe impl Sync for ReentrantMutex { }
156
156
157
157
impl ReentrantMutex {
158
158
pub const fn uninitialized ( ) -> ReentrantMutex {
159
- ReentrantMutex { inner : UnsafeCell :: new ( MaybeUninit :: uninit ( ) ) }
159
+ ReentrantMutex { inner : MaybeUninit :: uninit ( ) }
160
160
}
161
161
162
162
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 ( ) ) ) ;
164
164
}
165
165
166
166
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 ( ) ) ) ;
168
168
}
169
169
170
170
#[ inline]
171
171
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
173
173
}
174
174
175
175
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 ( ) ) ) ;
177
177
}
178
178
179
179
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 ( ) ) ) ;
181
181
}
182
182
}
0 commit comments