diff options
Diffstat (limited to 'kern/thread.h')
-rw-r--r-- | kern/thread.h | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/kern/thread.h b/kern/thread.h index 6e696fc7..5b5729ce 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) @@ -705,6 +712,28 @@ thread_get_specific(unsigned int key) return thread_tsd_get(thread_self(), key); } +#ifdef CONFIG_PERFMON +static inline struct perfmon_td * +thread_get_perfmon_td(struct thread *thread) +{ + return &thread->perfmon_td; +} +#endif /* CONFIG_PERFMON */ + +/* + * Return the last CPU on which the thread has been scheduled. + * + * This call isn't synchronized, and the caller may obtain an outdated value. + */ +unsigned int thread_cpu(const struct thread *thread); + +/* + * 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. * |