mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-07 16:13:07 +00:00
score: Direct thread dispatch in a self restart
Commit 73ebf9a27e accidentally removed the
direct thread dispatch in a self thread restart. In case of a self
restart (always in task context) the directive shall not return. If
this is not possible due to a bad thread dispatch disable level, then a
fatal error shall occur.
Update #4412.
This commit is contained in:
@@ -539,6 +539,7 @@ Status_Control _Thread_Restart(
|
|||||||
{
|
{
|
||||||
Thread_Life_state previous;
|
Thread_Life_state previous;
|
||||||
Per_CPU_Control *cpu_self;
|
Per_CPU_Control *cpu_self;
|
||||||
|
bool is_self_restart;
|
||||||
Thread_Life_state ignored_life_states;
|
Thread_Life_state ignored_life_states;
|
||||||
Thread_queue_Context queue_context;
|
Thread_queue_Context queue_context;
|
||||||
|
|
||||||
@@ -550,11 +551,10 @@ Status_Control _Thread_Restart(
|
|||||||
}
|
}
|
||||||
|
|
||||||
cpu_self = _Thread_Dispatch_disable_critical( lock_context );
|
cpu_self = _Thread_Dispatch_disable_critical( lock_context );
|
||||||
|
is_self_restart = ( the_thread == _Per_CPU_Get_executing( cpu_self ) &&
|
||||||
|
!_Per_CPU_Is_ISR_in_progress( cpu_self ) );
|
||||||
|
|
||||||
if (
|
if ( is_self_restart ) {
|
||||||
the_thread == _Per_CPU_Get_executing( cpu_self ) &&
|
|
||||||
!_Per_CPU_Is_ISR_in_progress( cpu_self )
|
|
||||||
) {
|
|
||||||
ignored_life_states = THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED;
|
ignored_life_states = THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED;
|
||||||
} else {
|
} else {
|
||||||
ignored_life_states = 0;
|
ignored_life_states = 0;
|
||||||
@@ -582,7 +582,13 @@ Status_Control _Thread_Restart(
|
|||||||
_Thread_Wait_release( the_thread, &queue_context );
|
_Thread_Wait_release( the_thread, &queue_context );
|
||||||
|
|
||||||
_Thread_Priority_update( &queue_context );
|
_Thread_Priority_update( &queue_context );
|
||||||
|
|
||||||
|
if ( is_self_restart ) {
|
||||||
|
_Thread_Dispatch_direct_no_return( cpu_self );
|
||||||
|
} else {
|
||||||
_Thread_Dispatch_enable( cpu_self );
|
_Thread_Dispatch_enable( cpu_self );
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESSFUL;
|
return STATUS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user