diff options
author | Ian Moffett <ian@osmora.org> | 2024-02-26 00:14:10 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-02-26 00:14:10 -0500 |
commit | d0c5a584ab842b3c0829918ceeeacb7a37eb16aa (patch) | |
tree | 9f00adf2438739f55878ddecf48993907ed23eff /sys/kern | |
parent | f64c424c547a981a764e2a4a92e70f6e27245bdf (diff) |
kernel: sched: Fix PID allocation logic
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sched.c | 3 |
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); |