From 342c127a05a23913845f80c200af9a30d0c06068 Mon Sep 17 00:00:00 2001
From: Ian Moffett <ian@osmora.org>
Date: Mon, 15 Jul 2024 22:33:43 -0400
Subject: kernel: fork: Pre-increment nthreads

Signed-off-by: Ian Moffett <ian@osmora.org>
---
 sys/kern/kern_fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'sys')

diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c
index 421f478..037026b 100644
--- a/sys/kern/kern_fork.c
+++ b/sys/kern/kern_fork.c
@@ -63,7 +63,7 @@ fork1(struct proc *cur, int flags, void(*ip)(void), struct proc **newprocp)
     if (newprocp != NULL)
         *newprocp = newproc;
 
-    newproc->pid = nthreads++;
+    newproc->pid = ++nthreads;
     sched_enqueue_td(newproc);
 done:
     if (status != 0)
-- 
cgit v1.2.3