aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Thread.zig
diff options
context:
space:
mode:
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.