aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread/Futex.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-02-19 10:10:59 -0500
committerGitHub <noreply@github.com>2023-02-19 10:10:59 -0500
commit0bb178bbb2451238a326c6e916ecf38fbc34cab1 (patch)
treeb2499481c929ba1497d6eef8b85cc46205f953ab /lib/std/Thread/Futex.zig
parent346ec15c5005e523c2a1d4b967ee7a4e5d1e9775 (diff)
parent5fc6bbe71eeecb195d2cda2a2522e7fd04749d5b (diff)
downloadzig-0bb178bbb2451238a326c6e916ecf38fbc34cab1.tar.gz
zig-0bb178bbb2451238a326c6e916ecf38fbc34cab1.zip
Merge pull request #14671 from ziglang/multi-object-for
implement multi-object for loops
Diffstat (limited to 'lib/std/Thread/Futex.zig')
-rw-r--r--lib/std/Thread/Futex.zig6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig
index 15ef35698e..7efdc69d3b 100644
--- a/lib/std/Thread/Futex.zig
+++ b/lib/std/Thread/Futex.zig
@@ -895,7 +895,7 @@ test "Futex - signaling" {
var threads = [_]std.Thread{undefined} ** num_threads;
// Create a circle of paddles which hit each other
- for (threads) |*t, i| {
+ for (&threads, 0..) |*t, i| {
const paddle = &paddles[i];
const hit_to = &paddles[(i + 1) % paddles.len];
t.* = try std.Thread.spawn(.{}, Paddle.run, .{ paddle, hit_to });
@@ -950,14 +950,14 @@ test "Futex - broadcasting" {
threads: [num_threads]std.Thread = undefined,
fn run(self: *@This()) !void {
- for (self.barriers) |*barrier| {
+ for (&self.barriers) |*barrier| {
try barrier.wait();
}
}
};
var broadcast = Broadcast{};
- for (broadcast.threads) |*t| t.* = try std.Thread.spawn(.{}, Broadcast.run, .{&broadcast});
+ for (&broadcast.threads) |*t| t.* = try std.Thread.spawn(.{}, Broadcast.run, .{&broadcast});
for (broadcast.threads) |t| t.join();
}