Skip to content

Commit dc81cbd

Browse files
committed
No longer put windows mutexes in a box.
Windows SRW locks are movable (while not borrowed) according to their documentation.
1 parent 4f1353e commit dc81cbd

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library/std/src/sys/windows/mutex.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ pub struct Mutex {
2929
lock: AtomicUsize,
3030
}
3131

32-
pub type MovableMutex = Box<Mutex>;
32+
// Windows SRW Locks are movable (while not borrowed).
33+
// ReentrantMutexes (in Inner) are not, but those are stored indirectly through
34+
// a Box, so do not move when the Mutex it self is moved.
35+
pub type MovableMutex = Mutex;
3336

3437
unsafe impl Send for Mutex {}
3538
unsafe impl Sync for Mutex {}

0 commit comments

Comments
 (0)