summaryrefslogtreecommitdiff
path: root/kern/thread.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2017-02-08 21:58:38 +0100
committerRichard Braun <rbraun@sceen.net>2017-02-08 21:58:38 +0100
commite69a4c4c3ca62d816bb4542792bcc741a7360af2 (patch)
tree19516cdd779a8a759e26db3cbde4bc4103946dbc /kern/thread.h
parent05f3b97ee07e6af26613dfbfe57619a700aa349a (diff)
kern/thread: add wait channels
Diffstat (limited to 'kern/thread.h')
-rw-r--r--kern/thread.h19
1 files changed, 18 insertions, 1 deletions
diff --git a/kern/thread.h b/kern/thread.h
index 074963de..c5405d7f 100644
--- a/kern/thread.h
+++ b/kern/thread.h
@@ -192,12 +192,17 @@ void thread_join(struct thread *thread);
* In any case, the preemption nesting level must strictly be one when calling
* this function.
*
+ * The wait channel describes the reason why the thread is sleeping. The
+ * address should refer to a relevant synchronization object, normally
+ * containing the interlock, but not necessarily.
+ *
* This is a low level thread control primitive that should only be called by
* higher thread synchronization functions.
*
* Implies a memory barrier.
*/
-void thread_sleep(struct spinlock *interlock);
+void thread_sleep(struct spinlock *interlock, const void *wchan_addr,
+ const char *wchan_desc);
/*
* Schedule a thread for execution on a processor.
@@ -242,6 +247,18 @@ void thread_tick_intr(void);
void thread_setscheduler(struct thread *thread, unsigned char policy,
unsigned short priority);
+static inline const void *
+thread_wchan_addr(const struct thread *thread)
+{
+ return thread->wchan_addr;
+}
+
+static inline const char *
+thread_wchan_desc(const struct thread *thread)
+{
+ return thread->wchan_desc;
+}
+
/*
* Return a character representation of the state of a thread.
*/