mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-09-21 09:05:06 +08:00
score: Properly continue the thread during restart
The _Thread_queue_Extract() does not deal with potential priority updates and the SMP locking protocol handling. Use _Thread_queue_Continue(). For the POSIX signals processing this is currently probably unnecessary, however, the use case is similar to the restart so use the same appoach. Close #4546.
This commit is contained in:
@@ -106,6 +106,8 @@ typedef enum {
|
||||
STATUS_BUILD( STATUS_CLASSIC_INCORRECT_STATE, EINVAL ),
|
||||
STATUS_INTERRUPTED =
|
||||
STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, EINTR ),
|
||||
STATUS_INTERNAL_ERROR =
|
||||
STATUS_BUILD( STATUS_CLASSIC_INTERNAL_ERROR, ENOTSUP ),
|
||||
STATUS_INVALID_ADDRESS =
|
||||
STATUS_BUILD( STATUS_CLASSIC_INVALID_ADDRESS, EFAULT ),
|
||||
STATUS_INVALID_ID =
|
||||
|
||||
@@ -2698,16 +2698,19 @@ extern "C" {
|
||||
* continue its execution.
|
||||
*
|
||||
* @param[in, out] the_thread is the thread.
|
||||
*
|
||||
* @param status is the thread wait status.
|
||||
*/
|
||||
RTEMS_INLINE_ROUTINE void _Thread_Timer_remove_and_continue(
|
||||
Thread_Control *the_thread
|
||||
Thread_Control *the_thread,
|
||||
Status_Control status
|
||||
)
|
||||
{
|
||||
_Thread_Timer_remove( the_thread );
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
_Thread_MP_Extract_proxy( the_thread );
|
||||
#endif
|
||||
_Thread_queue_Extract( the_thread );
|
||||
_Thread_Continue( the_thread, status );
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -175,15 +175,6 @@ static bool _POSIX_signals_Unblock_thread_done(
|
||||
return status;
|
||||
}
|
||||
|
||||
static void _POSIX_signals_Interrupt_thread( Thread_Control *the_thread )
|
||||
{
|
||||
#if defined(RTEMS_MULTIPROCESSING)
|
||||
_Thread_MP_Extract_proxy( the_thread );
|
||||
#endif
|
||||
the_thread->Wait.return_code = STATUS_INTERRUPTED;
|
||||
_Thread_queue_Extract( the_thread );
|
||||
}
|
||||
|
||||
bool _POSIX_signals_Unblock_thread(
|
||||
Thread_Control *the_thread,
|
||||
int signo,
|
||||
@@ -215,7 +206,7 @@ bool _POSIX_signals_Unblock_thread(
|
||||
*the_info = *info;
|
||||
}
|
||||
|
||||
_POSIX_signals_Interrupt_thread( the_thread );
|
||||
_Thread_Timer_remove_and_continue( the_thread, STATUS_INTERRUPTED );
|
||||
return _POSIX_signals_Unblock_thread_done( the_thread, api, true );
|
||||
}
|
||||
|
||||
@@ -245,7 +236,7 @@ bool _POSIX_signals_Unblock_thread(
|
||||
*/
|
||||
|
||||
if ( _States_Is_interruptible_by_signal( the_thread->current_state ) ) {
|
||||
_POSIX_signals_Interrupt_thread( the_thread );
|
||||
_Thread_Timer_remove_and_continue( the_thread, STATUS_INTERRUPTED );
|
||||
}
|
||||
}
|
||||
return _POSIX_signals_Unblock_thread_done( the_thread, api, false );
|
||||
|
||||
@@ -137,7 +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_and_continue( the_thread );
|
||||
_Thread_Timer_remove_and_continue( the_thread, STATUS_INTERNAL_ERROR );
|
||||
|
||||
/*
|
||||
* Add the thread to the thread zombie chain before we wake up joining
|
||||
@@ -357,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() for removal of these states.
|
||||
* _Thread_Continue() for removal of these states.
|
||||
*/
|
||||
_Thread_Clear_state_locked(
|
||||
the_thread,
|
||||
@@ -408,7 +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_and_continue( the_thread );
|
||||
_Thread_Timer_remove_and_continue( the_thread, STATUS_INTERNAL_ERROR );
|
||||
_Thread_Remove_life_change_request( the_thread );
|
||||
} else {
|
||||
_Thread_Clear_state_locked( the_thread, STATES_SUSPENDED );
|
||||
|
||||
Reference in New Issue
Block a user