summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJennifer Averett <jennifer.averett@oarcorp.com>2012-05-01 13:08:03 -0500
committerJennifer Averett <jennifer.averett@oarcorp.com>2012-05-01 13:08:03 -0500
commite9578468aa10c332ed66a644e5be47b1295aef0c (patch)
treede4b72301d7c19277277c6fff67aaff81a965f19
parentAdded back in kqueue_schedtask() and kqueue_wakeup() (diff)
downloadrtems-libbsd-e9578468aa10c332ed66a644e5be47b1295aef0c.tar.bz2
Modifed sleep queue to be priority based and added the wakeup_one method.
-rw-r--r--rtemsbsd/src/rtems-bsd-synch.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/rtemsbsd/src/rtems-bsd-synch.c b/rtemsbsd/src/rtems-bsd-synch.c
index 1f78b840..b2b90ac0 100644
--- a/rtemsbsd/src/rtems-bsd-synch.c
+++ b/rtemsbsd/src/rtems-bsd-synch.c
@@ -71,7 +71,7 @@ sleepinit(void)
*/
_Thread_queue_Initialize(
&sleep_queue[ii].queue,
- THREAD_QUEUE_DISCIPLINE_FIFO,
+ THREAD_QUEUE_DISCIPLINE_PRIORITY,
STATES_WAITING_FOR_SLEEP | STATES_INTERRUPTIBLE_BY_SIGNAL,
EAGAIN
);
@@ -273,3 +273,24 @@ wakeup(void *ident)
return 0;
}
+/*
+ * Make a thread sleeping on the specified identifier runnable.
+ * May wake more than one thread if a target thread is currently
+ * swapped out.
+ */
+void
+wakeup_one(void *ident)
+{
+ sleep_queue_control_t *sq;
+ Thread_Control *the_thread;
+
+ sq = sleep_queue_lookup( ident );
+ if (sq == NULL)
+ {
+ return (0);
+ }
+ the_thread = _Thread_queue_Dequeue(&sq->queue);
+ return 0;
+
+}
+