summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-22 11:58:10 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2015-03-22 11:58:10 +0100
commitd2bdf5cc4d16d0f7041e876486fca3f66b4b7a26 (patch)
tree5fa7905f78cdbfd2e70926cc76da27856f68ced4
parentscore: Move _Thread_queue_Extract() (diff)
downloadrtems-d2bdf5cc4d16d0f7041e876486fca3f66b4b7a26.tar.bz2
score: Move _Thread_queue_Requeue()
Now all the main thread queue operations are in one module.
-rw-r--r--cpukit/score/Makefile.am2
-rw-r--r--cpukit/score/src/threadqenqueue.c42
-rw-r--r--cpukit/score/src/threadqrequeue.c67
3 files changed, 43 insertions, 68 deletions
diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 265a49689b..090f7f676e 100644
--- a/cpukit/score/Makefile.am
+++ b/cpukit/score/Makefile.am
@@ -298,7 +298,7 @@ endif
## THREADQ_C_FILES
libscore_a_SOURCES += src/threadq.c \
- src/threadqenqueue.c src/threadqrequeue.c \
+ src/threadqenqueue.c \
src/threadqextractwithproxy.c src/threadqfirst.c \
src/threadqflush.c src/threadqprocesstimeout.c src/threadqtimeout.c
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index fbc0ba0ff5..e1e876c885 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -296,3 +296,45 @@ Thread_Control *_Thread_queue_Dequeue(
return the_thread;
}
+
+void _Thread_queue_Requeue(
+ Thread_queue_Control *the_thread_queue,
+ Thread_Control *the_thread
+)
+{
+ /*
+ * Just in case the thread really wasn't blocked on a thread queue
+ * when we get here.
+ */
+ if ( !the_thread_queue )
+ return;
+
+ /*
+ * If queueing by FIFO, there is nothing to do. This only applies to
+ * priority blocking discipline.
+ */
+ if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
+ Thread_queue_Control *tq = the_thread_queue;
+ ISR_Level level;
+
+ _ISR_Disable( level );
+ if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
+ _Thread_queue_Enter_critical_section( tq );
+
+ /* extract the thread */
+ _RBTree_Extract(
+ &the_thread->Wait.queue->Queues.Priority,
+ &the_thread->RBNode
+ );
+
+ /* enqueue the thread at the new priority */
+ _RBTree_Insert(
+ &the_thread_queue->Queues.Priority,
+ &the_thread->RBNode,
+ _Thread_queue_Compare_priority,
+ false
+ );
+ }
+ _ISR_Enable( level );
+ }
+}
diff --git a/cpukit/score/src/threadqrequeue.c b/cpukit/score/src/threadqrequeue.c
deleted file mode 100644
index 791a59e73c..0000000000
--- a/cpukit/score/src/threadqrequeue.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * @file
- *
- * @brief Thread Queue Requeue
- * @ingroup ScoreThreadQ
- */
-
-/*
- * COPYRIGHT (c) 1989-2014.
- * On-Line Applications Research Corporation (OAR).
- *
- * 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/threadqimpl.h>
-#include <rtems/score/isrlevel.h>
-#include <rtems/score/threadimpl.h>
-#include <rtems/score/watchdogimpl.h>
-
-void _Thread_queue_Requeue(
- Thread_queue_Control *the_thread_queue,
- Thread_Control *the_thread
-)
-{
- /*
- * Just in case the thread really wasn't blocked on a thread queue
- * when we get here.
- */
- if ( !the_thread_queue )
- return;
-
- /*
- * If queueing by FIFO, there is nothing to do. This only applies to
- * priority blocking discipline.
- */
- if ( the_thread_queue->discipline == THREAD_QUEUE_DISCIPLINE_PRIORITY ) {
- Thread_queue_Control *tq = the_thread_queue;
- ISR_Level level;
-
- _ISR_Disable( level );
- if ( _States_Is_waiting_on_thread_queue( the_thread->current_state ) ) {
- _Thread_queue_Enter_critical_section( tq );
-
- /* extract the thread */
- _RBTree_Extract(
- &the_thread->Wait.queue->Queues.Priority,
- &the_thread->RBNode
- );
-
- /* enqueue the thread at the new priority */
- _RBTree_Insert(
- &the_thread_queue->Queues.Priority,
- &the_thread->RBNode,
- _Thread_queue_Compare_priority,
- false
- );
- }
- _ISR_Enable( level );
- }
-}
-