We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6bb6d7 commit 7c4738eCopy full SHA for 7c4738e
library/std/src/sys/windows/mutex.rs
@@ -134,15 +134,10 @@ impl Mutex {
134
0 => {}
135
n => return n as *const _,
136
}
137
- let inner = box Inner { remutex: ReentrantMutex::uninitialized(), held: Cell::new(false) };
138
unsafe {
+ let inner = box Inner { remutex: ReentrantMutex::uninitialized(), held: Cell::new(false) };
139
inner.remutex.init();
140
- }
141
142
-
143
- unsafe fn flag_locked(&self) -> bool {
144
- // SAFETY: The caller must ensure that the mutex is not moved or copied
145
- unsafe {
+ let inner = Box::into_raw(inner);
146
match self.lock.compare_and_swap(0, inner as usize, Ordering::SeqCst) {
147
0 => inner,
148
n => {
0 commit comments