summaryrefslogtreecommitdiff
path: root/kern/thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'kern/thread.h')
-rw-r--r--kern/thread.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/kern/thread.h b/kern/thread.h
index 6e696fc7..cc1a8a2b 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -75,6 +75,13 @@ struct thread_sched_data {
#define THREAD_KERNEL_PREFIX KERNEL_NAME "_"
/*
+ * Thread states.
+ */
+#define THREAD_RUNNING 0
+#define THREAD_SLEEPING 1
+#define THREAD_DEAD 2
+
+/*
* Scheduling policies.
*
* The idle policy is reserved for the per-CPU idle threads.
@@ -323,7 +330,7 @@ thread_wchan_desc(const struct thread *thread)
/*
* Return a character representation of the state of a thread.
*/
-char thread_state_to_chr(const struct thread *thread);
+char thread_state_to_chr(unsigned int state);
static inline const struct thread_sched_data *
thread_get_user_sched_data(const struct thread *thread)
@@ -706,6 +713,13 @@ thread_get_specific(unsigned int key)
}
/*
+ * Return the current state of the given thread.
+ *
+ * This call isn't synchronized, and the caller may obtain an outdated value.
+ */
+unsigned int thread_state(const struct thread *thread);
+
+/*
* Return true if the given thread is running.
*
* Note that this check is speculative, and may not return an accurate