[PATCH 19/19] posix: Avoid Giant lock in _POSIX_signals_Send()

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Apr 29 09:13:19 UTC 2016


Update #2555.
Update #2690.
---
 cpukit/posix/src/killinfo.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/cpukit/posix/src/killinfo.c b/cpukit/posix/src/killinfo.c
index 3df670c..b16b408 100644
--- a/cpukit/posix/src/killinfo.c
+++ b/cpukit/posix/src/killinfo.c
@@ -76,6 +76,7 @@ int _POSIX_signals_Send(
   POSIX_signals_Siginfo_node  *psiginfo;
   Thread_queue_Heads          *heads;
   ISR_lock_Context             lock_context;
+  Per_CPU_Control             *cpu_self;
 
   /*
    *  Only supported for the "calling process" (i.e. this node).
@@ -120,13 +121,14 @@ int _POSIX_signals_Send(
     siginfo->si_value = *value;
   }
 
-  _Thread_Disable_dispatch();
+  /* FIXME: https://devel.rtems.org/ticket/2690 */
+  cpu_self = _Thread_Dispatch_disable();
 
   /*
    *  Is the currently executing thread interested?  If so then it will
    *  get it an execute it as soon as the dispatcher executes.
    */
-  the_thread = _Thread_Executing;
+  the_thread = _Per_CPU_Get_executing( cpu_self );
 
   api = the_thread->API_Extensions[ THREAD_API_POSIX ];
   if ( _POSIX_signals_Is_interested( api, mask ) ) {
@@ -320,7 +322,7 @@ process_it:
    *  blocked waiting for the signal.
    */
   if ( _POSIX_signals_Unblock_thread( the_thread, sig, siginfo ) ) {
-    _Thread_Enable_dispatch();
+    _Thread_Dispatch_enable( cpu_self );
     return 0;
   }
 
@@ -340,7 +342,7 @@ post_process_signal:
       _Chain_Get_unprotected( &_POSIX_signals_Inactive_siginfo );
     if ( !psiginfo ) {
       _POSIX_signals_Release( &lock_context );
-      _Thread_Enable_dispatch();
+      _Thread_Dispatch_enable( cpu_self );
       rtems_set_errno_and_return_minus_one( EAGAIN );
     }
 
@@ -354,6 +356,6 @@ post_process_signal:
 
   _POSIX_signals_Release( &lock_context );
   DEBUG_STEP("\n");
-  _Thread_Enable_dispatch();
+  _Thread_Dispatch_enable( cpu_self );
   return 0;
 }
-- 
1.8.4.5




More information about the devel mailing list