Skip to content

Commit

Permalink
No longer put windows mutexes in a box.
Browse files Browse the repository at this point in the history
Windows SRW locks are movable (while not borrowed) according to their
documentation.
  • Loading branch information
m-ou-se committed Oct 2, 2020
1 parent 4f1353e commit dc81cbd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion library/std/src/sys/windows/mutex.rs
Expand Up @@ -29,7 +29,10 @@ pub struct Mutex {
lock: AtomicUsize,
}

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

unsafe impl Send for Mutex {}
unsafe impl Sync for Mutex {}
Expand Down

0 comments on commit dc81cbd

Please sign in to comment.