aboutsummaryrefslogtreecommitdiff
path: root/lib/std/event/loop.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2023-11-22 18:49:18 -0700
committerAndrew Kelley <andrew@ziglang.org>2023-11-22 19:08:55 -0700
commit70931dbdea96d92feb60406c827e39e566317863 (patch)
treeee569fab186e848d73de1e4dbc272ff5f9f6b7c1 /lib/std/event/loop.zig
parentedb2f72988cd180c5d87b03481fa1c20b3325968 (diff)
downloadzig-70931dbdea96d92feb60406c827e39e566317863.tar.gz
zig-70931dbdea96d92feb60406c827e39e566317863.zip
rework std.atomic
* move std.atomic.Atomic to std.atomic.Value * fix incorrect argument order passed to testing.expectEqual * make the functions be a thin wrapper over the atomic builtins and stick to the naming conventions. * remove pointless functions loadUnchecked and storeUnchecked. Instead, name the field `raw` instead of `value` (which is redundant with the type name). * simplify the tests by not passing every possible combination. Many cases were iterating over every possible combinations but then not even using the for loop element value! * remove the redundant compile errors which are already implemented by the language itself. * remove dead x86 inline assembly. this should be implemented in the language if at all.
Diffstat (limited to 'lib/std/event/loop.zig')
-rw-r--r--lib/std/event/loop.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig
index 58cf09fbf5..d7b75a6672 100644
--- a/lib/std/event/loop.zig
+++ b/lib/std/event/loop.zig
@@ -7,7 +7,6 @@ const os = std.os;
const windows = os.windows;
const maxInt = std.math.maxInt;
const Thread = std.Thread;
-const Atomic = std.atomic.Atomic;
const is_windows = builtin.os.tag == .windows;
@@ -854,7 +853,7 @@ pub const Loop = struct {
waiters: Waiters,
thread: std.Thread,
event: std.Thread.ResetEvent,
- is_running: Atomic(bool),
+ is_running: std.atomic.Value(bool),
/// Initialize the delay queue by spawning the timer thread
/// and starting any timer resources.
@@ -866,7 +865,7 @@ pub const Loop = struct {
},
.thread = undefined,
.event = .{},
- .is_running = Atomic(bool).init(true),
+ .is_running = std.atomic.Value(bool).init(true),
};
// Must be after init so that it can read the other state, such as `is_running`.