[rtems commit] score: Move _Thread_queue_Requeue()

Sebastian Huber sebh at rtems.org
Sun Mar 22 11:06:37 UTC 2015


Module:    rtems
Branch:    master
Commit:    d2bdf5cc4d16d0f7041e876486fca3f66b4b7a26
Changeset: http://git.rtems.org/rtems/commit/?id=d2bdf5cc4d16d0f7041e876486fca3f66b4b7a26

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Sun Mar 22 11:58:10 2015 +0100

score: Move _Thread_queue_Requeue()

Now all the main thread queue operations are in one module.

---

 cpukit/score/Makefile.am          |  2 +-
 cpukit/score/src/threadqenqueue.c | 42 ++++++++++++++++++++++++
 cpukit/score/src/threadqrequeue.c | 67 ---------------------------------------
 3 files changed, 43 insertions(+), 68 deletions(-)

diff --git a/cpukit/score/Makefile.am b/cpukit/score/Makefile.am
index 265a496..090f7f6 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 fbc0ba0..e1e876c 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 791a59e..0000000
--- 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 );
-  }
-}
-



More information about the vc mailing list