summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadqops.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-04-21 10:17:13 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-05-19 12:00:45 +0200
commit568af83542eec9343c24d417ed6a219d22046233 (patch)
treef66fde552c81c31930df66cb8a00444efeb0f30a /cpukit/score/src/threadqops.c
parentscore: Add Thread_queue_Control::Lock (diff)
downloadrtems-568af83542eec9343c24d417ed6a219d22046233.tar.bz2
score: Add Thread_queue_Operations
Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
Diffstat (limited to 'cpukit/score/src/threadqops.c')
-rw-r--r--cpukit/score/src/threadqops.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
new file mode 100644
index 0000000000..561480130a
--- /dev/null
+++ b/cpukit/score/src/threadqops.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Dornierstr. 4
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#if HAVE_CONFIG_H
+ #include "config.h"
+#endif
+
+#include <rtems/score/threadimpl.h>
+#include <rtems/score/rbtreeimpl.h>
+
+static void _Thread_queue_Do_nothing_priority_change(
+ Thread_Control *the_thread,
+ Priority_Control new_priority,
+ Thread_queue_Control *queue
+)
+{
+ /* Do nothing */
+}
+
+static void _Thread_queue_Priority_priority_change(
+ Thread_Control *the_thread,
+ Priority_Control new_priority,
+ Thread_queue_Control *queue
+)
+{
+ _RBTree_Extract( &queue->Queues.Priority, &the_thread->RBNode );
+ _RBTree_Insert(
+ &queue->Queues.Priority,
+ &the_thread->RBNode,
+ _Thread_queue_Compare_priority,
+ false
+ );
+}
+
+const Thread_queue_Operations _Thread_queue_Operations_default = {
+ .priority_change = _Thread_queue_Do_nothing_priority_change
+};
+
+const Thread_queue_Operations _Thread_queue_Operations_FIFO = {
+ .priority_change = _Thread_queue_Do_nothing_priority_change
+};
+
+const Thread_queue_Operations _Thread_queue_Operations_priority = {
+ .priority_change = _Thread_queue_Priority_priority_change
+};