aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-06-13 20:39:40 -0400
committerGitHub <noreply@github.com>2021-06-13 20:39:40 -0400
commit86ebd4b975d2f1e01f468e06daab6e28c06f9719 (patch)
tree250bfe03e0768bdf7619fa8bb588b6815e1d3f0d /lib/std/Thread
parentdf4f11f42f44b4ee2a06e43095bc160277ceed42 (diff)
parente63ff4f1c110165c4b92025cb5b9d5531e861643 (diff)
downloadzig-86ebd4b975d2f1e01f468e06daab6e28c06f9719.tar.gz
zig-86ebd4b975d2f1e01f468e06daab6e28c06f9719.zip
Merge pull request #9106 from Vexu/fmt
Add formatting check to CI pipeline
Diffstat (limited to 'lib/std/Thread')
-rw-r--r--lib/std/Thread/Futex.zig16
1 files changed, 8 insertions, 8 deletions
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
+}