diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2025-01-02 03:10:19 -0500 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2025-01-16 20:42:08 -0500 |
| commit | e5d5a8bc4ea6b27dc3540ad4800a1231ff50b33d (patch) | |
| tree | 114481f7bbf4d5e6a4703a7606f654dabb5df330 /lib/std/Thread | |
| parent | ac1a975f9b5a7d939663fa90556a2f038250c531 (diff) | |
| download | zig-e5d5a8bc4ea6b27dc3540ad4800a1231ff50b33d.tar.gz zig-e5d5a8bc4ea6b27dc3540ad4800a1231ff50b33d.zip | |
x86_64: implement switch jump tables
Diffstat (limited to 'lib/std/Thread')
| -rw-r--r-- | lib/std/Thread/Condition.zig | 6 | ||||
| -rw-r--r-- | lib/std/Thread/Mutex.zig | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/std/Thread/Condition.zig b/lib/std/Thread/Condition.zig index e6c25d761c..65bfa32ad0 100644 --- a/lib/std/Thread/Condition.zig +++ b/lib/std/Thread/Condition.zig @@ -161,17 +161,17 @@ const WindowsImpl = struct { } } - if (comptime builtin.mode == .Debug) { + if (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, - if (comptime builtin.mode == .Debug) &mutex.impl.impl.srwlock else &mutex.impl.srwlock, + if (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) { + if (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); } diff --git a/lib/std/Thread/Mutex.zig b/lib/std/Thread/Mutex.zig index be421c4c94..402c96a4d5 100644 --- a/lib/std/Thread/Mutex.zig +++ b/lib/std/Thread/Mutex.zig @@ -158,7 +158,7 @@ const FutexImpl = struct { // On x86, use `lock bts` instead of `lock cmpxchg` as: // - they both seem to mark the cache-line as modified regardless: https://stackoverflow.com/a/63350048 // - `lock bts` is smaller instruction-wise which makes it better for inlining - if (comptime builtin.target.cpu.arch.isX86()) { + if (builtin.target.cpu.arch.isX86()) { const locked_bit = @ctz(locked); return self.state.bitSet(locked_bit, .acquire) == 0; } |
