zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 59e33b447b0502bdfa18909f4381360bb8f49b70 (tree)
parent 56cfa8f22f69d813efedb1fa01fdcb7077ca0e5a
Author: biexelar <biexelar@disroot.org>
Date:   Wed, 31 Aug 2022 02:31:47 +0000

std.Thread: fix freeAndExit on x86_64-linux (#12693)

Previously, this function used incorrect registers for the munmap syscall, leading to detached threads not cleaning up.

closes #12690

Co-authored-by: bxlr <biexelar@diroot.org>
Diffstat:
Mlib/std/Thread.zig | 7++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig @@ -769,16 +769,13 @@ const LinuxThreadImpl = struct { ), .x86_64 => asm volatile ( \\ movq $11, %%rax - \\ movq %[ptr], %%rbx - \\ movq %[len], %%rcx \\ syscall \\ movq $60, %%rax \\ movq $1, %%rdi \\ syscall : - : [ptr] "r" (@ptrToInt(self.mapped.ptr)), - [len] "r" (self.mapped.len), - : "memory" + : [ptr] "{rdi}" (@ptrToInt(self.mapped.ptr)), + [len] "{rsi}" (self.mapped.len), ), .arm, .armeb, .thumb, .thumbeb => asm volatile ( \\ mov r7, #91