aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorTristan Ross <tristan.ross@midstall.com>2024-02-18 21:52:23 -0800
committerTristan Ross <tristan.ross@midstall.com>2024-03-11 07:09:10 -0700
commit6067d39522f939c08dd3f3ea4fb5889ff0024e72 (patch)
tree0eb768171ecfb058fba72d199afc951af206f8fb /lib/std/Thread.zig
parentc260b4c753d1e5f947e0d33ce39ce173e497309f (diff)
downloadzig-6067d39522f939c08dd3f3ea4fb5889ff0024e72.tar.gz
zig-6067d39522f939c08dd3f3ea4fb5889ff0024e72.zip
std.builtin: make atomic order fields lowercase
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig24
1 files changed, 12 insertions, 12 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index a043f267bf..574e573c13 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -510,7 +510,7 @@ const WindowsThreadImpl = struct {
fn entryFn(raw_ptr: windows.PVOID) callconv(.C) windows.DWORD {
const self: *@This() = @ptrCast(@alignCast(raw_ptr));
- defer switch (self.thread.completion.swap(.completed, .SeqCst)) {
+ defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
.running => {},
.completed => unreachable,
.detached => self.thread.free(),
@@ -563,7 +563,7 @@ const WindowsThreadImpl = struct {
fn detach(self: Impl) void {
windows.CloseHandle(self.thread.thread_handle);
- switch (self.thread.completion.swap(.detached, .SeqCst)) {
+ switch (self.thread.completion.swap(.detached, .seq_cst)) {
.running => {},
.completed => self.thread.free(),
.detached => unreachable,
@@ -573,7 +573,7 @@ const WindowsThreadImpl = struct {
fn join(self: Impl) void {
windows.WaitForSingleObjectEx(self.thread.thread_handle, windows.INFINITE, false) catch unreachable;
windows.CloseHandle(self.thread.thread_handle);
- assert(self.thread.completion.load(.SeqCst) == .completed);
+ assert(self.thread.completion.load(.seq_cst) == .completed);
self.thread.free();
}
};
@@ -780,11 +780,11 @@ const WasiThreadImpl = struct {
}
fn getHandle(self: Impl) ThreadHandle {
- return self.thread.tid.load(.SeqCst);
+ return self.thread.tid.load(.seq_cst);
}
fn detach(self: Impl) void {
- switch (self.thread.state.swap(.detached, .SeqCst)) {
+ switch (self.thread.state.swap(.detached, .seq_cst)) {
.running => {},
.completed => self.join(),
.detached => unreachable,
@@ -801,7 +801,7 @@ const WasiThreadImpl = struct {
var spin: u8 = 10;
while (true) {
- const tid = self.thread.tid.load(.SeqCst);
+ const tid = self.thread.tid.load(.seq_cst);
if (tid == 0) {
break;
}
@@ -901,7 +901,7 @@ const WasiThreadImpl = struct {
if (tid < 0) {
return error.SystemResources;
}
- instance.thread.tid.store(tid, .SeqCst);
+ instance.thread.tid.store(tid, .seq_cst);
return .{ .thread = &instance.thread };
}
@@ -914,12 +914,12 @@ const WasiThreadImpl = struct {
}
__set_stack_pointer(arg.thread.memory.ptr + arg.stack_offset);
__wasm_init_tls(arg.thread.memory.ptr + arg.tls_offset);
- @atomicStore(u32, &WasiThreadImpl.tls_thread_id, @intCast(tid), .SeqCst);
+ @atomicStore(u32, &WasiThreadImpl.tls_thread_id, @intCast(tid), .seq_cst);
// Finished bootstrapping, call user's procedure.
arg.call_back(arg.raw_ptr);
- switch (arg.thread.state.swap(.completed, .SeqCst)) {
+ switch (arg.thread.state.swap(.completed, .seq_cst)) {
.running => {
// reset the Thread ID
asm volatile (
@@ -1191,7 +1191,7 @@ const LinuxThreadImpl = struct {
fn entryFn(raw_arg: usize) callconv(.C) u8 {
const self = @as(*@This(), @ptrFromInt(raw_arg));
- defer switch (self.thread.completion.swap(.completed, .SeqCst)) {
+ defer switch (self.thread.completion.swap(.completed, .seq_cst)) {
.running => {},
.completed => unreachable,
.detached => self.thread.freeAndExit(),
@@ -1311,7 +1311,7 @@ const LinuxThreadImpl = struct {
}
fn detach(self: Impl) void {
- switch (self.thread.completion.swap(.detached, .SeqCst)) {
+ switch (self.thread.completion.swap(.detached, .seq_cst)) {
.running => {},
.completed => self.join(),
.detached => unreachable,
@@ -1323,7 +1323,7 @@ const LinuxThreadImpl = struct {
var spin: u8 = 10;
while (true) {
- const tid = self.thread.child_tid.load(.SeqCst);
+ const tid = self.thread.child_tid.load(.seq_cst);
if (tid == 0) {
break;
}