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!
This commit is contained in:
Timon Kruiper 2021-01-23 16:42:34 +01:00 committed by Andrew Kelley
parent 15278b7f4b
commit 4f7d76f19c
2 changed files with 6 additions and 2 deletions

View File

@ -103,7 +103,11 @@ pub const Node = struct {
} }
parent.completeOne(); parent.completeOne();
} else { } else {
self.context.done = true; {
const held = self.context.update_lock.acquire();
defer held.release();
self.context.done = true;
}
self.context.refresh(); self.context.refresh();
} }
} }

View File

@ -299,6 +299,6 @@ pub extern "kernel32" fn SleepConditionVariableSRW(
f: ULONG, f: ULONG,
) callconv(WINAPI) BOOL; ) 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 AcquireSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;
pub extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void; pub extern "kernel32" fn ReleaseSRWLockExclusive(s: *SRWLOCK) callconv(WINAPI) void;