[rtems commit] score: Move _Thread_queue_Extract()

Sebastian Huber sebh at rtems.org
Tue Nov 23 13:34:54 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Nov 11 09:00:03 2021 +0100

score: Move _Thread_queue_Extract()

Move _Thread_queue_Extract() since this function is not used by the core
services (threads, semaphores, mutexes, message queues).

Update #4546.

---

 cpukit/include/rtems/score/threadqimpl.h |  7 +++-
 cpukit/score/src/threadqenqueue.c        | 37 ++-------------------
 cpukit/score/src/threadqextract.c        | 57 ++++++++++++++++++++++++++++++++
 spec/build/cpukit/librtemscpu.yml        |  1 +
 4 files changed, 67 insertions(+), 35 deletions(-)

diff --git a/cpukit/include/rtems/score/threadqimpl.h b/cpukit/include/rtems/score/threadqimpl.h
index 1831787..7dd7250 100644
--- a/cpukit/include/rtems/score/threadqimpl.h
+++ b/cpukit/include/rtems/score/threadqimpl.h
@@ -1296,18 +1296,23 @@ RTEMS_INLINE_ROUTINE void _Thread_queue_Destroy(
 #endif
 }
 
+#if defined(RTEMS_MULTIPROCESSING)
 /**
  * @brief Does nothing.
  *
  * @param the_proxy This parameter is unused.
  * @param mp_id This parameter is unused.
  */
-#if defined(RTEMS_MULTIPROCESSING)
 void _Thread_queue_MP_callout_do_nothing(
   Thread_Control *the_proxy,
   Objects_Id      mp_id
 );
 
+bool _Thread_queue_MP_set_callout(
+  Thread_Control             *the_thread,
+  const Thread_queue_Context *queue_context
+);
+
 /**
  * @brief Unblocks the proxy of the thread.
  *
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 7b42cda..73098d9 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -7,8 +7,8 @@
  *   _Thread_queue_Deadlock_fatal(), _Thread_queue_Deadlock_status(),
  *   _Thread_queue_Do_dequeue(), _Thread_queue_Enqueue(),
  *   _Thread_queue_Enqueue_do_nothing_extra(), _Thread_queue_Enqueue_sticky(),
- *   _Thread_queue_Extract(), _Thread_queue_Extract_locked(),
- *   _Thread_queue_Path_acquire(), _Thread_queue_Path_release(),
+ *   _Thread_queue_Extract_locked(), _Thread_queue_Path_acquire(),
+ *   _Thread_queue_Path_release(),
  *   _Thread_queue_Resume(),_Thread_queue_Surrender(),
  *   _Thread_queue_Surrender_no_priority(), _Thread_queue_Surrender_sticky().
  */
@@ -531,7 +531,7 @@ Status_Control _Thread_queue_Enqueue_sticky(
 #endif
 
 #if defined(RTEMS_MULTIPROCESSING)
-static bool _Thread_queue_MP_set_callout(
+bool _Thread_queue_MP_set_callout(
   Thread_Control             *the_thread,
   const Thread_queue_Context *queue_context
 )
@@ -668,37 +668,6 @@ void _Thread_queue_Resume(
   }
 }
 
-void _Thread_queue_Extract( Thread_Control *the_thread )
-{
-  Thread_queue_Context  queue_context;
-  Thread_queue_Queue   *queue;
-
-  _Thread_queue_Context_initialize( &queue_context );
-  _Thread_queue_Context_clear_priority_updates( &queue_context );
-  _Thread_Wait_acquire( the_thread, &queue_context );
-
-  queue = the_thread->Wait.queue;
-
-  if ( queue != NULL ) {
-    _Thread_Wait_remove_request( the_thread, &queue_context.Lock_context );
-    _Thread_queue_Context_set_MP_callout(
-      &queue_context,
-      _Thread_queue_MP_callout_do_nothing
-    );
-#if defined(RTEMS_MULTIPROCESSING)
-    _Thread_queue_MP_set_callout( the_thread, &queue_context );
-#endif
-    ( *the_thread->Wait.operations->extract )(
-      queue,
-      the_thread,
-      &queue_context
-    );
-    _Thread_queue_Resume( queue, the_thread, &queue_context );
-  } else {
-    _Thread_Wait_release( the_thread, &queue_context );
-  }
-}
-
 void _Thread_queue_Surrender(
   Thread_queue_Queue            *queue,
   Thread_queue_Heads            *heads,
diff --git a/cpukit/score/src/threadqextract.c b/cpukit/score/src/threadqextract.c
new file mode 100644
index 0000000..0c6efed
--- /dev/null
+++ b/cpukit/score/src/threadqextract.c
@@ -0,0 +1,57 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreThreadQueue
+ *
+ * @brief This source file contains the implementation of
+ *   _Thread_queue_Extract().
+ */
+
+/*
+ *  COPYRIGHT (c) 1989-2014.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  Copyright (c) 2015, 2016 embedded brains GmbH.
+ *
+ *  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.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems/score/threadqimpl.h>
+#include <rtems/score/threadimpl.h>
+
+void _Thread_queue_Extract( Thread_Control *the_thread )
+{
+  Thread_queue_Context  queue_context;
+  Thread_queue_Queue   *queue;
+
+  _Thread_queue_Context_initialize( &queue_context );
+  _Thread_queue_Context_clear_priority_updates( &queue_context );
+  _Thread_Wait_acquire( the_thread, &queue_context );
+
+  queue = the_thread->Wait.queue;
+
+  if ( queue != NULL ) {
+    _Thread_Wait_remove_request( the_thread, &queue_context.Lock_context );
+    _Thread_queue_Context_set_MP_callout(
+      &queue_context,
+      _Thread_queue_MP_callout_do_nothing
+    );
+#if defined(RTEMS_MULTIPROCESSING)
+    _Thread_queue_MP_set_callout( the_thread, &queue_context );
+#endif
+    ( *the_thread->Wait.operations->extract )(
+      queue,
+      the_thread,
+      &queue_context
+    );
+    _Thread_queue_Resume( queue, the_thread, &queue_context );
+  } else {
+    _Thread_Wait_release( the_thread, &queue_context );
+  }
+}
diff --git a/spec/build/cpukit/librtemscpu.yml b/spec/build/cpukit/librtemscpu.yml
index b6ee8b9..111b686 100644
--- a/spec/build/cpukit/librtemscpu.yml
+++ b/spec/build/cpukit/librtemscpu.yml
@@ -1561,6 +1561,7 @@ source:
 - cpukit/score/src/threadplaindispatch.c
 - cpukit/score/src/threadq.c
 - cpukit/score/src/threadqenqueue.c
+- cpukit/score/src/threadqextract.c
 - cpukit/score/src/threadqfirst.c
 - cpukit/score/src/threadqflush.c
 - cpukit/score/src/threadqgetnameandid.c



More information about the vc mailing list