[rtems commit] score: Remove _Thread_queue_First_locked()

Sebastian Huber sebh at rtems.org
Thu Sep 2 05:47:59 UTC 2021


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

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Aug 31 12:42:29 2021 +0200

score: Remove _Thread_queue_First_locked()

The _Thread_queue_First_locked() was only used in one place.  Move the code of
this inline function to this place.

---

 cpukit/include/rtems/score/threadqimpl.h | 28 ----------------------------
 cpukit/score/src/threadqfirst.c          | 10 +++++++++-
 2 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/cpukit/include/rtems/score/threadqimpl.h b/cpukit/include/rtems/score/threadqimpl.h
index 0a24d2d..19d9704 100644
--- a/cpukit/include/rtems/score/threadqimpl.h
+++ b/cpukit/include/rtems/score/threadqimpl.h
@@ -1139,34 +1139,6 @@ RTEMS_INLINE_ROUTINE bool _Thread_queue_Is_empty(
  * @brief Returns the first thread on the thread queue if it exists, otherwise
  * @c NULL.
  *
- * The caller must be the owner of the thread queue lock.  The thread queue
- * lock is not released.
- *
- * @param the_thread_queue The thread queue.
- * @param operations The thread queue operations.
- *
-* @retval first The first thread on the thread queue according to the enqueue
- * order.
- * @retval NULL No thread is present on the thread queue.
- */
-RTEMS_INLINE_ROUTINE Thread_Control *_Thread_queue_First_locked(
-  Thread_queue_Control          *the_thread_queue,
-  const Thread_queue_Operations *operations
-)
-{
-  Thread_queue_Heads *heads = the_thread_queue->Queue.heads;
-
-  if ( heads != NULL ) {
-    return ( *operations->first )( heads );
-  } else {
-    return NULL;
-  }
-}
-
-/**
- * @brief Returns the first thread on the thread queue if it exists, otherwise
- * @c NULL.
- *
  * @param the_thread_queue The thread queue.
  *
  * @retval first The first thread on the thread queue according to the enqueue
diff --git a/cpukit/score/src/threadqfirst.c b/cpukit/score/src/threadqfirst.c
index 9908523..8edbc16 100644
--- a/cpukit/score/src/threadqfirst.c
+++ b/cpukit/score/src/threadqfirst.c
@@ -27,11 +27,19 @@ Thread_Control *_Thread_queue_First(
   const Thread_queue_Operations *operations
 )
 {
+  Thread_queue_Heads   *heads;
   Thread_Control       *the_thread;
   Thread_queue_Context  queue_context;
 
   _Thread_queue_Acquire( the_thread_queue, &queue_context );
-  the_thread = _Thread_queue_First_locked( the_thread_queue, operations );
+  heads = the_thread_queue->Queue.heads;
+
+  if ( heads != NULL ) {
+    the_thread = ( *operations->first )( heads );
+  } else {
+    the_thread = NULL;
+  }
+
   _Thread_queue_Release( the_thread_queue, &queue_context );
 
   return the_thread;



More information about the vc mailing list