summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-02-26 00:14:10 -0500
committerIan Moffett <ian@osmora.org>2024-02-26 00:14:10 -0500
commitd0c5a584ab842b3c0829918ceeeacb7a37eb16aa (patch)
tree9f00adf2438739f55878ddecf48993907ed23eff /sys
parentf64c424c547a981a764e2a4a92e70f6e27245bdf (diff)
kernel: sched: Fix PID allocation logic
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_sched.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index ff26e0a..01f2efe 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -43,6 +43,7 @@
* scheduled should be added to this queue.
*/
static TAILQ_HEAD(, proc) td_queue;
+static size_t nthread = 0;
/*
* Thread queue lock - all operations to `td_queue'
@@ -79,7 +80,7 @@ sched_enqueue_td(struct proc *td)
spinlock_acquire(&tdq_lock);
- td->pid = TAILQ_NELEM(&td_queue);
+ td->pid = nthread++;
TAILQ_INSERT_TAIL(&td_queue, td, link);
spinlock_release(&tdq_lock);