summaryrefslogtreecommitdiff
path: root/kern/sleepq.h
diff options
context:
space:
mode:
authorRichard Braun <rbraun@sceen.net>2018-01-06 23:28:08 +0100
committerRichard Braun <rbraun@sceen.net>2018-01-06 23:28:08 +0100
commita97a2bc6f1c24851ef19600a7bd15b211137abfe (patch)
treeda6532992f523df92a642031eda4cc8750398a2b /kern/sleepq.h
parenta56a2183e428ef806225482eff5b44da9b79e306 (diff)
kern/sleepq: fix signal behaviour
In order to correctly implement the behaviour of condition_signal, which must wake up at least one waiting thread if there's any, sleepq_signal wakes up the oldest waiter and shifts it. The FIFO behaviour is removed from the specification, as the only user which relied on it was a previous condition variable implementation.
Diffstat (limited to 'kern/sleepq.h')
-rw-r--r--kern/sleepq.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/kern/sleepq.h b/kern/sleepq.h
index 827d0436..007e3f2f 100644
--- a/kern/sleepq.h
+++ b/kern/sleepq.h
@@ -105,8 +105,6 @@ bool sleepq_empty(const struct sleepq *sleepq);
* released, e.g. if a single thread is waiting and another signals
* the queue, the queue is not immediately considered empty.
*
- * Threads are queued in FIFO order.
- *
* When bounding the duration of the wait, the caller must pass an absolute
* time in ticks, and ERROR_TIMEDOUT is returned if that time is reached
* before the sleep queue is signalled.
@@ -124,10 +122,8 @@ int sleepq_timedwait(struct sleepq *sleepq, const char *wchan, uint64_t ticks);
* acquired) when waiting, and acquired in order to signal it,
* wake-ups are serialized and cannot be missed.
*
- * Threads are queued in FIFO order, which means signalling a sleep
- * queue multiple times always awakens the same thread, regardless
- * of new waiters, as long as that thread didn't reacquire the
- * sleep queue.
+ * At least one thread is awaken if any threads are waiting on the sleep
+ * queue.
*
* A broadcast differs only by also making all currently waiting threads
* pending for wake-up. As with sleepq_signal, a single thread may be