[PATCH 4/5] score: Remove _Thread_queue_Unblock_critical()

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Aug 31 11:24:24 UTC 2021


This function was only used in one place.  Replace it with a call to
_Thread_queue_Resume().
---
 cpukit/include/rtems/score/threadqimpl.h | 34 ++++-----------------
 cpukit/score/src/threadqenqueue.c        | 38 ++++--------------------
 2 files changed, 12 insertions(+), 60 deletions(-)

diff --git a/cpukit/include/rtems/score/threadqimpl.h b/cpukit/include/rtems/score/threadqimpl.h
index 19d9704dec..f42c67cc47 100644
--- a/cpukit/include/rtems/score/threadqimpl.h
+++ b/cpukit/include/rtems/score/threadqimpl.h
@@ -938,13 +938,12 @@ Status_Control _Thread_queue_Enqueue_sticky(
  * @param[in, out] the_thread The thread to extract.
  * @param[in, out] queue_context The thread queue context.
  *
- * @return Returns the unblock indicator for _Thread_queue_Unblock_critical().
- * True indicates, that this thread must be unblocked by the scheduler later in
- * _Thread_queue_Unblock_critical(), and false otherwise.  In case false is
- * returned, then the thread queue enqueue procedure was interrupted.  Thus it
- * will unblock itself and the thread wait information is no longer accessible,
- * since this thread may already block on another resource in an SMP
- * configuration.
+ * @return Returns the unblock indicator.  True indicates, that this thread
+ * must be unblocked by the scheduler using _Thread_Remove_timer_and_unblock(),
+ * and false otherwise.  In case false is returned, then the thread queue
+ * enqueue procedure was interrupted.  Thus it will unblock itself and the
+ * thread wait information is no longer accessible, since this thread may
+ * already block on another resource in an SMP configuration.
  */
 bool _Thread_queue_Extract_locked(
   Thread_queue_Queue            *queue,
@@ -953,27 +952,6 @@ bool _Thread_queue_Extract_locked(
   Thread_queue_Context          *queue_context
 );
 
-/**
- * @brief Unblocks the thread which was on the thread queue before.
- *
- * The caller must be the owner of the thread queue lock.  This function will
- * release the thread queue lock.  Thread dispatching is disabled before the
- * thread queue lock is released and an unblock is necessary.  Thread
- * dispatching is enabled once the sequence to unblock the thread is complete.
- *
- * @param unblock The unblock indicator returned by
- * _Thread_queue_Extract_locked().
- * @param queue The actual thread queue.
- * @param[in, out] the_thread The thread to extract.
- * @param[in, out] lock_context The lock context of the lock acquire.
- */
-void _Thread_queue_Unblock_critical(
-  bool                unblock,
-  Thread_queue_Queue *queue,
-  Thread_Control     *the_thread,
-  ISR_lock_Context   *lock_context
-);
-
 /**
  * @brief Resumes the extracted or surrendered thread.
  *
diff --git a/cpukit/score/src/threadqenqueue.c b/cpukit/score/src/threadqenqueue.c
index 833d37ee61..4b138ba4d1 100644
--- a/cpukit/score/src/threadqenqueue.c
+++ b/cpukit/score/src/threadqenqueue.c
@@ -11,7 +11,7 @@
  *   _Thread_queue_Path_acquire_critical(),
  *   _Thread_queue_Path_release_critical(),
  *   _Thread_queue_Resume(),_Thread_queue_Surrender(),
- *   _Thread_queue_Surrender_sticky(), and _Thread_queue_Unblock_critical().
+ *   _Thread_queue_Surrender_sticky().
  */
 
 /*
@@ -584,27 +584,6 @@ bool _Thread_queue_Extract_locked(
   return _Thread_queue_Make_ready_again( the_thread );
 }
 
-void _Thread_queue_Unblock_critical(
-  bool                unblock,
-  Thread_queue_Queue *queue,
-  Thread_Control     *the_thread,
-  ISR_lock_Context   *lock_context
-)
-{
-  if ( unblock ) {
-    Per_CPU_Control *cpu_self;
-
-    cpu_self = _Thread_Dispatch_disable_critical( lock_context );
-    _Thread_queue_Queue_release( queue, lock_context );
-
-    _Thread_Remove_timer_and_unblock( the_thread, queue );
-
-    _Thread_Dispatch_enable( cpu_self );
-  } else {
-    _Thread_queue_Queue_release( queue, lock_context );
-  }
-}
-
 void _Thread_queue_Resume(
   Thread_queue_Queue   *queue,
   Thread_Control       *the_thread,
@@ -645,25 +624,20 @@ void _Thread_queue_Extract( Thread_Control *the_thread )
   queue = the_thread->Wait.queue;
 
   if ( queue != NULL ) {
-    bool unblock;
-
     _Thread_Wait_remove_request( the_thread, &queue_context.Lock_context );
     _Thread_queue_Context_set_MP_callout(
       &queue_context,
       _Thread_queue_MP_callout_do_nothing
     );
-    unblock = _Thread_queue_Extract_locked(
+#if defined(RTEMS_MULTIPROCESSING)
+    _Thread_queue_MP_set_callout( the_thread, &queue_context );
+#endif
+    ( *the_thread->Wait.operations->extract )(
       queue,
-      the_thread->Wait.operations,
       the_thread,
       &queue_context
     );
-    _Thread_queue_Unblock_critical(
-      unblock,
-      queue,
-      the_thread,
-      &queue_context.Lock_context.Lock_context
-    );
+    _Thread_queue_Resume( queue, the_thread, &queue_context );
   } else {
     _Thread_Wait_release( the_thread, &queue_context );
   }
-- 
2.26.2



More information about the devel mailing list