]> git.lizzy.rs Git - rust.git/commitdiff
Window Mutex: make sure we properly initialize the SRWLock
authorRalf Jung <post@ralfj.de>
Mon, 13 Aug 2018 19:15:42 +0000 (21:15 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 13 Aug 2018 20:45:13 +0000 (22:45 +0200)
src/libstd/sys/windows/mutex.rs

index 9bf9f749d4df252c89182265ccb7fc3d80290631..58f24eb132351b96b83f33156468a7e73d3c87be 100644 (file)
@@ -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),
         }