[PATCH 09/13] rtems: Move _Signal_Action_handler()

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Feb 17 19:30:24 UTC 2021


Move _Signal_Action_handler() and signal MP initialization to
rtems_signal_send().  The goal is to make _Signal_Action_handler() a
static function in a follow up patch.

Update #4244.
---
 cpukit/rtems/src/signalcatch.c | 54 ----------------------------------
 cpukit/rtems/src/signalsend.c  | 54 ++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 54 deletions(-)

diff --git a/cpukit/rtems/src/signalcatch.c b/cpukit/rtems/src/signalcatch.c
index 27d7503a31..e4ff15fd40 100644
--- a/cpukit/rtems/src/signalcatch.c
+++ b/cpukit/rtems/src/signalcatch.c
@@ -21,51 +21,13 @@
 #include "config.h"
 #endif
 
-#include <rtems/sysinit.h>
 #include <rtems/rtems/signalimpl.h>
 #include <rtems/rtems/asrimpl.h>
 #include <rtems/rtems/tasksdata.h>
-#include <rtems/score/assert.h>
 #include <rtems/score/threadimpl.h>
 
 RTEMS_STATIC_ASSERT( RTEMS_DEFAULT_MODES == 0, _ASR_Create_mode_set );
 
-void _Signal_Action_handler(
-  Thread_Control   *executing,
-  Thread_Action    *action,
-  ISR_lock_Context *lock_context
-)
-{
-  RTEMS_API_Control *api;
-  ASR_Information   *asr;
-  rtems_signal_set   signal_set;
-  rtems_mode      prev_mode;
-
-  (void) action;
-
-  /*
-   *  Signal Processing
-   */
-
-  api = executing->API_Extensions[ THREAD_API_RTEMS ];
-  asr = &api->Signal;
-  signal_set = _ASR_Get_posted_signals( asr );
-
-  if ( signal_set == 0 ) {
-    return;
-  }
-
-  _Thread_State_release( executing, lock_context );
-
-  rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
-
-  (*asr->handler)( signal_set );
-
-  rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
-
-  _Thread_State_acquire( executing, lock_context );
-}
-
 rtems_status_code rtems_signal_catch(
   rtems_asr_entry   asr_handler,
   rtems_mode        mode_set
@@ -90,19 +52,3 @@ rtems_status_code rtems_signal_catch(
   _Thread_State_release( executing, &lock_context );
   return RTEMS_SUCCESSFUL;
 }
-
-#if defined(RTEMS_MULTIPROCESSING)
-static void _Signal_MP_Initialize( void )
-{
-  _MPCI_Register_packet_processor(
-    MP_PACKET_SIGNAL,
-    _Signal_MP_Process_packet
-  );
-}
-
-RTEMS_SYSINIT_ITEM(
-  _Signal_MP_Initialize,
-  RTEMS_SYSINIT_CLASSIC_SIGNAL_MP,
-  RTEMS_SYSINIT_ORDER_MIDDLE
-);
-#endif
diff --git a/cpukit/rtems/src/signalsend.c b/cpukit/rtems/src/signalsend.c
index efc3a9566a..fc8a66b6c6 100644
--- a/cpukit/rtems/src/signalsend.c
+++ b/cpukit/rtems/src/signalsend.c
@@ -26,6 +26,44 @@
 #include <rtems/score/threaddispatch.h>
 #include <rtems/score/threadimpl.h>
 
+#include <rtems/sysinit.h>
+
+void _Signal_Action_handler(
+  Thread_Control   *executing,
+  Thread_Action    *action,
+  ISR_lock_Context *lock_context
+)
+{
+  RTEMS_API_Control *api;
+  ASR_Information   *asr;
+  rtems_signal_set   signal_set;
+  rtems_mode      prev_mode;
+
+  (void) action;
+
+  /*
+   *  Signal Processing
+   */
+
+  api = executing->API_Extensions[ THREAD_API_RTEMS ];
+  asr = &api->Signal;
+  signal_set = _ASR_Get_posted_signals( asr );
+
+  if ( signal_set == 0 ) {
+    return;
+  }
+
+  _Thread_State_release( executing, lock_context );
+
+  rtems_task_mode( asr->mode_set, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+  (*asr->handler)( signal_set );
+
+  rtems_task_mode( prev_mode, RTEMS_ALL_MODE_MASKS, &prev_mode );
+
+  _Thread_State_acquire( executing, lock_context );
+}
+
 rtems_status_code rtems_signal_send(
   rtems_id          id,
   rtems_signal_set  signal_set
@@ -79,3 +117,19 @@ rtems_status_code rtems_signal_send(
 
   return RTEMS_SUCCESSFUL;
 }
+
+#if defined(RTEMS_MULTIPROCESSING)
+static void _Signal_MP_Initialize( void )
+{
+  _MPCI_Register_packet_processor(
+    MP_PACKET_SIGNAL,
+    _Signal_MP_Process_packet
+  );
+}
+
+RTEMS_SYSINIT_ITEM(
+  _Signal_MP_Initialize,
+  RTEMS_SYSINIT_CLASSIC_SIGNAL_MP,
+  RTEMS_SYSINIT_ORDER_MIDDLE
+);
+#endif
-- 
2.26.2



More information about the devel mailing list