aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread/Mutex.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-18 09:02:57 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-02-18 19:17:21 -0700
commitaeaef8c0ffadab4145fd002f2edd87a6db66ebd1 (patch)
treee4c76c76173e5e72bc1947e1886662c4c6b2ba3c /lib/std/Thread/Mutex.zig
parentf0530385b57218ef323747bdb7438330a07d25cc (diff)
downloadzig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.tar.gz
zig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.zip
update std lib and compiler sources to new for loop syntax
Diffstat (limited to 'lib/std/Thread/Mutex.zig')
-rw-r--r--lib/std/Thread/Mutex.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/Thread/Mutex.zig b/lib/std/Thread/Mutex.zig
index ecb3556b6c..89dedaf2b7 100644
--- a/lib/std/Thread/Mutex.zig
+++ b/lib/std/Thread/Mutex.zig
@@ -245,7 +245,7 @@ const NonAtomicCounter = struct {
}
fn inc(self: *NonAtomicCounter) void {
- for (@bitCast([2]u64, self.get() + 1)) |v, i| {
+ for (@bitCast([2]u64, self.get() + 1), 0..) |v, i| {
@ptrCast(*volatile u64, &self.value[i]).* = v;
}
}
@@ -277,7 +277,7 @@ test "Mutex - many uncontended" {
};
var runners = [_]Runner{.{}} ** num_threads;
- for (runners) |*r| r.thread = try Thread.spawn(.{}, Runner.run, .{r});
+ for (&runners) |*r| r.thread = try Thread.spawn(.{}, Runner.run, .{r});
for (runners) |r| r.thread.join();
for (runners) |r| try testing.expectEqual(r.counter.get(), num_increments);
}
@@ -312,7 +312,7 @@ test "Mutex - many contended" {
var runner = Runner{};
var threads: [num_threads]Thread = undefined;
- for (threads) |*t| t.* = try Thread.spawn(.{}, Runner.run, .{&runner});
+ for (&threads) |*t| t.* = try Thread.spawn(.{}, Runner.run, .{&runner});
for (threads) |t| t.join();
try testing.expectEqual(runner.counter.get(), num_increments * num_threads);