aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-02-24 21:29:01 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-02-24 21:29:23 -0700
commit5f35dc0c0d0530d5a1d028c56a763def3d1fd250 (patch)
tree75a0872005d2f0e5a1c12c31072a471e9ea185d8 /lib/std/Thread.zig
parentd7049fc8e0709619b8aa6766b37abeae946703b2 (diff)
downloadzig-5f35dc0c0d0530d5a1d028c56a763def3d1fd250.tar.gz
zig-5f35dc0c0d0530d5a1d028c56a763def3d1fd250.zip
zig fmt the std lib
Diffstat (limited to 'lib/std/Thread.zig')
-rw-r--r--lib/std/Thread.zig23
1 files changed, 7 insertions, 16 deletions
diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig
index ea878bbdb0..80de19fe19 100644
--- a/lib/std/Thread.zig
+++ b/lib/std/Thread.zig
@@ -70,16 +70,8 @@ else switch (std.Target.current.os.tag) {
/// Signals the processor that it is inside a busy-wait spin-loop ("spin lock").
pub fn spinLoopHint() void {
switch (std.Target.current.cpu.arch) {
- .i386, .x86_64 => asm volatile ("pause"
- :
- :
- : "memory"
- ),
- .arm, .aarch64 => asm volatile ("yield"
- :
- :
- : "memory"
- ),
+ .i386, .x86_64 => asm volatile ("pause" ::: "memory"),
+ .arm, .aarch64 => asm volatile ("yield" ::: "memory"),
else => {},
}
}
@@ -90,12 +82,11 @@ pub fn spinLoopHint() void {
pub fn getCurrentId() Id {
if (use_pthreads) {
return c.pthread_self();
- } else
- return switch (std.Target.current.os.tag) {
- .linux => os.linux.gettid(),
- .windows => windows.kernel32.GetCurrentThreadId(),
- else => @compileError("Unsupported OS"),
- };
+ } else return switch (std.Target.current.os.tag) {
+ .linux => os.linux.gettid(),
+ .windows => windows.kernel32.GetCurrentThreadId(),
+ else => @compileError("Unsupported OS"),
+ };
}
/// Returns the handle of this thread.