summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-03-15 18:39:47 -0400
committerIan Moffett <ian@osmora.org>2024-03-15 19:56:09 -0400
commit1e7a1c0d90f6eb339e3e68c7b91bb21e81e06d5c (patch)
treeda862150dbebe2e3ac0e9dea37d4f84887b073a2 /sys/kern
parentec2da40e65346bd5d3055777a76852892da21ea7 (diff)
kernel: sched: Add routine to get current thread
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sched.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c
index 117e0c1..d775e5a 100644
--- a/sys/kern/kern_sched.c
+++ b/sys/kern/kern_sched.c
@@ -322,6 +322,20 @@ sched_exit(void)
}
/*
+ * Get the current running thread.
+ */
+struct proc *
+this_td(void)
+{
+ struct sched_state *state;
+ struct cpu_info *ci;
+
+ ci = this_cpu();
+ state = &ci->sched_state;
+ return state->td;
+}
+
+/*
* Thread context switch routine
*/
void