From 8a72954d7a900736ce85f05cfa8c0df1c013acaa Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 13 Aug 2018 21:15:42 +0200 Subject: [PATCH 1/2] Window Mutex: make sure we properly initialize the SRWLock --- src/libstd/sys/windows/mutex.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index 9bf9f749d4df2..58f24eb132351 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -58,6 +58,8 @@ pub unsafe fn raw(m: &Mutex) -> c::PSRWLOCK { impl Mutex { pub const fn new() -> Mutex { Mutex { + // This works because SRWLOCK_INIT is a NULL pointer, so we are also properly + // initializing an SRWLOCK here. lock: AtomicUsize::new(0), held: UnsafeCell::new(false), } From b7a49e7c9e720039f3d2c54a38be73126d052d09 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 14 Aug 2018 12:52:37 +0200 Subject: [PATCH 2/2] fixed wording --- src/libstd/sys/windows/mutex.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libstd/sys/windows/mutex.rs b/src/libstd/sys/windows/mutex.rs index 58f24eb132351..b0e7331e2b651 100644 --- a/src/libstd/sys/windows/mutex.rs +++ b/src/libstd/sys/windows/mutex.rs @@ -58,7 +58,7 @@ pub unsafe fn raw(m: &Mutex) -> c::PSRWLOCK { impl Mutex { pub const fn new() -> Mutex { Mutex { - // This works because SRWLOCK_INIT is a NULL pointer, so we are also properly + // This works because SRWLOCK_INIT is 0 (wrapped in a struct), so we are also properly // initializing an SRWLOCK here. lock: AtomicUsize::new(0), held: UnsafeCell::new(false),