diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 09:02:57 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2023-02-18 19:17:21 -0700 |
| commit | aeaef8c0ffadab4145fd002f2edd87a6db66ebd1 (patch) | |
| tree | e4c76c76173e5e72bc1947e1886662c4c6b2ba3c /lib/std/Thread/Condition.zig | |
| parent | f0530385b57218ef323747bdb7438330a07d25cc (diff) | |
| download | zig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.tar.gz zig-aeaef8c0ffadab4145fd002f2edd87a6db66ebd1.zip | |
update std lib and compiler sources to new for loop syntax
Diffstat (limited to 'lib/std/Thread/Condition.zig')
| -rw-r--r-- | lib/std/Thread/Condition.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/Thread/Condition.zig b/lib/std/Thread/Condition.zig index ab75a0e5e2..793779dbdb 100644 --- a/lib/std/Thread/Condition.zig +++ b/lib/std/Thread/Condition.zig @@ -341,7 +341,7 @@ test "Condition - wait and signal" { }; var multi_wait = MultiWait{}; - for (multi_wait.threads) |*t| { + for (&multi_wait.threads) |*t| { t.* = try std.Thread.spawn(.{}, MultiWait.run, .{&multi_wait}); } @@ -389,7 +389,7 @@ test "Condition - signal" { }; var signal_test = SignalTest{}; - for (signal_test.threads) |*t| { + for (&signal_test.threads) |*t| { t.* = try std.Thread.spawn(.{}, SignalTest.run, .{&signal_test}); } @@ -457,7 +457,7 @@ test "Condition - multi signal" { 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 }); @@ -468,7 +468,7 @@ test "Condition - multi signal" { for (threads) |t| t.join(); // The first paddle will be hit one last time by the last paddle. - for (paddles) |p, i| { + for (paddles, 0..) |p, i| { const expected = @as(u32, num_iterations) + @boolToInt(i == 0); try testing.expectEqual(p.value, expected); } @@ -513,7 +513,7 @@ test "Condition - broadcasting" { }; var broadcast_test = BroadcastTest{}; - for (broadcast_test.threads) |*t| { + for (&broadcast_test.threads) |*t| { t.* = try std.Thread.spawn(.{}, BroadcastTest.run, .{&broadcast_test}); } @@ -584,7 +584,7 @@ test "Condition - broadcasting - wake all threads" { var broadcast_test = BroadcastTest{}; var thread_id: usize = 1; - for (broadcast_test.threads) |*t| { + for (&broadcast_test.threads) |*t| { t.* = try std.Thread.spawn(.{}, BroadcastTest.run, .{ &broadcast_test, thread_id }); thread_id += 1; } |
