score: Improve parameters in _Thread_Change_life()

This commit is contained in:
Sebastian Huber
2021-05-14 17:02:57 +02:00
parent 98cb84ea2f
commit 6f2c8f32e6
2 changed files with 29 additions and 22 deletions

View File

@@ -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
);

View File

@@ -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 );