diff options
Diffstat (limited to 'lib/std/Thread/Condition.zig')
| -rw-r--r-- | lib/std/Thread/Condition.zig | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/std/Thread/Condition.zig b/lib/std/Thread/Condition.zig index 70ad0728eb..ab75a0e5e2 100644 --- a/lib/std/Thread/Condition.zig +++ b/lib/std/Thread/Condition.zig @@ -161,12 +161,20 @@ const WindowsImpl = struct { } } + if (comptime builtin.mode == .Debug) { + // The internal state of the DebugMutex needs to be handled here as well. + mutex.impl.locking_thread.store(0, .Unordered); + } const rc = os.windows.kernel32.SleepConditionVariableSRW( &self.condition, - &mutex.impl.srwlock, + if (comptime builtin.mode == .Debug) &mutex.impl.impl.srwlock else &mutex.impl.srwlock, timeout_ms, 0, // the srwlock was assumed to acquired in exclusive mode not shared ); + if (comptime builtin.mode == .Debug) { + // The internal state of the DebugMutex needs to be handled here as well. + mutex.impl.locking_thread.store(std.Thread.getCurrentId(), .Unordered); + } // Return error.Timeout if we know the timeout elapsed correctly. if (rc == os.windows.FALSE) { |
