Commit 4f7d76f19c

Timon Kruiper <timonkruiper@gmail.com>
2021-01-23 16:42:34
fix windows bug in Progress.zig
This bug caused the compiler to deadlock when multiple c objects were build in parallel. Thanks @kprotty for finding this bug!
1 parent 15278b7
Changed files (2)
lib
lib/std/os/windows/kernel32.zig
@@ -299,6 +299,6 @@ pub extern "kernel32" fn SleepConditionVariableSRW(
     f: ULONG,
 ) callconv(WINAPI) BOOL;
 
-pub extern "kernel32" fn TryAcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) BOOL;
+pub extern "kernel32" fn TryAcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) BOOLEAN;
 pub extern "kernel32" fn AcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
 pub extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
lib/std/Progress.zig
@@ -103,7 +103,11 @@ pub const Node = struct {
             }
             parent.completeOne();
         } else {
-            self.context.done = true;
+            {
+                const held = self.context.update_lock.acquire();
+                defer held.release();
+                self.context.done = true;
+            }
             self.context.refresh();
         }
     }