From 94305d2680e55dbfc363ca613146dfc2818f0171 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sat, 17 Jun 2023 14:40:04 +0200 Subject: Added thread waiting --- sort.asm | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sort.asm b/sort.asm index 9b3569b..c66b6a9 100644 --- a/sort.asm +++ b/sort.asm @@ -19,6 +19,7 @@ loop: jnz loop end: + call thread_wait_all pop rbp mov rax, 0x3c mov rdi, 0 @@ -78,6 +79,19 @@ thread_run: mov rax, r10 ret +thread_wait_all: + sub rsp, 4 + mov rdi, -1 + mov rax, 0x3d + mov rsi, rsp + xor rdx, rdx + xor r10, r10 + syscall ; wait4 + add rsp, 4 + cmp rax, -10 ; idk why + jne thread_wait_all + ret + child: call rax -- cgit v1.2.3