From b9f07b7ac227134001258e5933e3ef61aae80303 Mon Sep 17 00:00:00 2001 From: jacob gw Date: Thu, 11 Mar 2021 22:53:39 -0500 Subject: format zig files and add formatting check to ci --- lib/std/Thread/Futex.zig | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'lib/std/Thread') diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 01353e9fb8..356a4e2046 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -84,7 +84,7 @@ else const WindowsFutex = struct { const windows = std.os.windows; - + fn wait(ptr: *const Atomic(u32), expect: u32, timeout: ?u64) error{TimedOut}!void { var timeout_value: windows.LARGE_INTEGER = undefined; var timeout_ptr: ?*const windows.LARGE_INTEGER = null; @@ -299,7 +299,7 @@ const PosixFutex = struct { state: State = .empty, cond: std.c.pthread_cond_t = .{}, mutex: std.c.pthread_mutex_t = .{}, - + const Self = @This(); const State = enum { empty, @@ -381,7 +381,7 @@ test "Futex - wait/wake" { const wait_noop_result = Futex.wait(&value, 0, 0); try testing.expectError(error.TimedOut, wait_noop_result); - + const wait_longer_result = Futex.wait(&value, 0, std.time.ns_per_ms); try testing.expectError(error.TimedOut, wait_longer_result); @@ -416,7 +416,7 @@ test "Futex - Signal" { const Thread = struct { tx: *Self, rx: *Self, - + const start_value = 1; fn run(self: Thread) void { @@ -472,7 +472,7 @@ test "Futex - Broadcast" { self.broadcast.store(BROADCAST_RECEIVED, .Release); Futex.wake(&self.broadcast, 1); } - } + } fn run() !void { var self = Self{}; @@ -542,7 +542,7 @@ test "Futex - Chain" { if (chain.index + 1 < chain.self.threads.len) { next_signal = &chain.self.threads[chain.index + 1].signal; } - + this_signal.wait(); next_signal.notify(); } @@ -554,7 +554,7 @@ test "Futex - Chain" { for (self.threads) |*entry, index| { entry.signal = .{}; entry.thread = try std.Thread.spawn(Chain.run, .{ - .self = &self, + .self = &self, .index = index, }); } @@ -567,4 +567,4 @@ test "Futex - Chain" { } } }).run(); -} \ No newline at end of file +} -- cgit v1.2.3