diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-11 08:35:22 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-11-23 11:00:28 +0100 |
commit | 50aef135a405a0dc26c39d7cfe7066f85b3dfbb5 (patch) | |
tree | 772b2944bdbd60ee514f04d78b5471fdbd71d480 /cpukit/score | |
parent | score: Remove thread timer earlier (diff) | |
download | rtems-50aef135a405a0dc26c39d7cfe7066f85b3dfbb5.tar.bz2 |
score: Add _Thread_MP_Extract_proxy()
Remove _Thread_queue_Extract_with_proxy() and move the proxy extraction
to _Thread_MP_Extract_proxy(). Move similar code blocks of the previous
caller of _Thread_queue_Extract_with_proxy() to helper functions.
Update #4546.
Diffstat (limited to 'cpukit/score')
-rw-r--r-- | cpukit/score/src/threadqextractwithproxy.c | 46 | ||||
-rw-r--r-- | cpukit/score/src/threadrestart.c | 8 |
2 files changed, 25 insertions, 29 deletions
diff --git a/cpukit/score/src/threadqextractwithproxy.c b/cpukit/score/src/threadqextractwithproxy.c index 1370aecb86..a61934a2b1 100644 --- a/cpukit/score/src/threadqextractwithproxy.c +++ b/cpukit/score/src/threadqextractwithproxy.c @@ -4,7 +4,7 @@ * @ingroup RTEMSScoreThreadQueue * * @brief This source file contains the implementation of - * _Thread_queue_Extract_with_proxy(). + * _Thread_MP_Extract_proxy(). */ /* @@ -20,32 +20,30 @@ #include "config.h" #endif -#include <rtems/score/threadqimpl.h> +#include <rtems/score/threadimpl.h> #include <rtems/score/objectimpl.h> #include <rtems/score/statesimpl.h> -void _Thread_queue_Extract_with_proxy( - Thread_Control *the_thread -) +void _Thread_MP_Extract_proxy( Thread_Control *the_thread ) { - #if defined(RTEMS_MULTIPROCESSING) - States_Control state; - - state = the_thread->current_state; - if ( _States_Is_waiting_for_rpc_reply( state ) && - _States_Is_locally_blocked( state ) ) { - Objects_Id id; - Objects_Information *the_information; - Objects_Thread_queue_Extract_callout proxy_extract_callout; - - id = the_thread->Wait.remote_id; - the_information = _Objects_Get_information_id( id ); - proxy_extract_callout = the_information->extract; - - if ( proxy_extract_callout != NULL ) - (*proxy_extract_callout)( the_thread, id ); - } - #endif + States_Control state; + + state = the_thread->current_state; + + if ( + _States_Is_waiting_for_rpc_reply( state ) && + _States_Is_locally_blocked( state ) + ) { + Objects_Id id; + const Objects_Information *the_information; + Objects_Thread_queue_Extract_callout proxy_extract_callout; - _Thread_queue_Extract( the_thread ); + id = the_thread->Wait.remote_id; + the_information = _Objects_Get_information_id( id ); + proxy_extract_callout = the_information->extract; + + if ( proxy_extract_callout != NULL ) { + ( *proxy_extract_callout )( the_thread, id ); + } + } } diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index 12a0329a73..d469705d2c 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -137,8 +137,7 @@ static void _Thread_Make_zombie( Thread_Control *the_thread ) _Objects_Close( &information->Objects, &the_thread->Object ); _Thread_Set_state( the_thread, STATES_ZOMBIE ); - _Thread_Timer_remove( the_thread ); - _Thread_queue_Extract_with_proxy( the_thread ); + _Thread_Timer_remove_and_continue( the_thread ); /* * Add the thread to the thread zombie chain before we wake up joining @@ -358,7 +357,7 @@ static void _Thread_Remove_life_change_request( Thread_Control *the_thread ) * Do not remove states used for thread queues to avoid race conditions on * SMP configurations. We could interrupt an extract operation on another * processor disregarding the thread wait flags. Rely on - * _Thread_queue_Extract_with_proxy() for removal of these states. + * _Thread_queue_Extract() for removal of these states. */ _Thread_Clear_state_locked( the_thread, @@ -409,8 +408,7 @@ static void _Thread_Try_life_change_request( _Thread_Add_life_change_request( the_thread ); _Thread_State_release( the_thread, lock_context ); - _Thread_Timer_remove( the_thread ); - _Thread_queue_Extract_with_proxy( the_thread ); + _Thread_Timer_remove_and_continue( the_thread ); _Thread_Remove_life_change_request( the_thread ); } else { _Thread_Clear_state_locked( the_thread, STATES_SUSPENDED ); |