[PATCH] score: Improve parameters in _Thread_Change_life()
Gedare Bloom
gedare at rtems.org
Fri May 14 20:29:01 UTC 2021
thanks, looks good
On Fri, May 14, 2021 at 9:05 AM Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
>
> ---
> cpukit/include/rtems/score/threadimpl.h | 22 ++++++++++---------
> cpukit/score/src/threadrestart.c | 29 +++++++++++++++----------
> 2 files changed, 29 insertions(+), 22 deletions(-)
>
> diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h
> index 44785cd937..1a5e391677 100644
> --- a/cpukit/include/rtems/score/threadimpl.h
> +++ b/cpukit/include/rtems/score/threadimpl.h
> @@ -297,18 +297,20 @@ Status_Control _Thread_Restart(
> void _Thread_Yield( Thread_Control *executing );
>
> /**
> - * @brief Changes the currently executing thread to a new state with the sets.
> + * @brief Changes the life of currently executing thread.
> *
> - * @param clear States to clear.
> - * @param set States to set.
> - * @param ignore States to ignore.
> + * @param life_states_to_clear are the thread life states to clear.
> *
> - * @return The previous state the thread was in.
> + * @param life_states_to_set are the thread life states to set.
> + *
> + * @param ignored_life_states are the ignored thread life states.
> + *
> + * @return Returns the thread life state before the changes.
> */
> Thread_Life_state _Thread_Change_life(
> - Thread_Life_state clear,
> - Thread_Life_state set,
> - Thread_Life_state ignore
> + Thread_Life_state life_states_to_clear,
> + Thread_Life_state life_states_to_set,
> + Thread_Life_state ignored_life_states
> );
>
> /**
> @@ -338,12 +340,12 @@ void _Thread_Kill_zombies( void );
> * @brief Exits the currently executing thread.
> *
> * @param[in, out] executing The currently executing thread.
> - * @param set The states to set.
> + * @param life_states_to_set The states to set.
> * @param[out] exit_value Contains the exit value of the thread.
> */
> void _Thread_Exit(
> Thread_Control *executing,
> - Thread_Life_state set,
> + Thread_Life_state life_states_to_set,
> void *exit_value
> );
>
> diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
> index 775f1c7a70..7a1c8e4635 100644
> --- a/cpukit/score/src/threadrestart.c
> +++ b/cpukit/score/src/threadrestart.c
> @@ -197,9 +197,9 @@ void _Thread_Kill_zombies( void )
>
> static Thread_Life_state _Thread_Change_life_locked(
> Thread_Control *the_thread,
> - Thread_Life_state clear,
> - Thread_Life_state set,
> - Thread_Life_state ignore
> + Thread_Life_state life_states_to_clear,
> + Thread_Life_state life_states_to_set,
> + Thread_Life_state ignored_life_states
> )
> {
> Thread_Life_state previous;
> @@ -207,11 +207,11 @@ static Thread_Life_state _Thread_Change_life_locked(
>
> previous = the_thread->Life.state;
> state = previous;
> - state &= ~clear;
> - state |= set;
> + state &= ~life_states_to_clear;
> + state |= life_states_to_set;
> the_thread->Life.state = state;
>
> - state &= ~ignore;
> + state &= ~ignored_life_states;
>
> if (
> _Thread_Is_life_change_allowed( state )
> @@ -491,7 +491,7 @@ void _Thread_Close(
>
> void _Thread_Exit(
> Thread_Control *executing,
> - Thread_Life_state set,
> + Thread_Life_state life_states_to_set,
> void *exit_value
> )
> {
> @@ -510,7 +510,7 @@ void _Thread_Exit(
> _Thread_Change_life_locked(
> executing,
> 0,
> - set,
> + life_states_to_set,
> THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED
> );
> _Thread_State_release( executing, &lock_context );
> @@ -583,9 +583,9 @@ Status_Control _Thread_Restart(
> }
>
> Thread_Life_state _Thread_Change_life(
> - Thread_Life_state clear,
> - Thread_Life_state set,
> - Thread_Life_state ignore
> + Thread_Life_state life_states_to_clear,
> + Thread_Life_state life_states_to_set,
> + Thread_Life_state ignored_life_states
> )
> {
> ISR_lock_Context lock_context;
> @@ -595,7 +595,12 @@ Thread_Life_state _Thread_Change_life(
>
> executing = _Thread_State_acquire_for_executing( &lock_context );
>
> - previous = _Thread_Change_life_locked( executing, clear, set, ignore );
> + previous = _Thread_Change_life_locked(
> + executing,
> + life_states_to_clear,
> + life_states_to_set,
> + ignored_life_states
> + );
>
> cpu_self = _Thread_Dispatch_disable_critical( &lock_context );
> _Thread_State_release( executing, &lock_context );
> --
> 2.26.2
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
More information about the devel
mailing list