[PATCH 6/6] score: Properly continue the thread during restart
Sebastian Huber
sebastian.huber at embedded-brains.de
Mon Nov 15 17:09:00 UTC 2021
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.
---
cpukit/include/rtems/score/status.h | 2 ++
cpukit/posix/src/psignalunblockthread.c | 4 ++--
cpukit/score/src/threadrestart.c | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/cpukit/include/rtems/score/status.h b/cpukit/include/rtems/score/status.h
index 236ae52d7b..96c0f1f9af 100644
--- a/cpukit/include/rtems/score/status.h
+++ b/cpukit/include/rtems/score/status.h
@@ -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 =
diff --git a/cpukit/posix/src/psignalunblockthread.c b/cpukit/posix/src/psignalunblockthread.c
index 1133234554..6921c14e46 100644
--- a/cpukit/posix/src/psignalunblockthread.c
+++ b/cpukit/posix/src/psignalunblockthread.c
@@ -180,8 +180,8 @@ 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 );
+ _Thread_Timer_remove( the_thread );
+ _Thread_Continue( the_thread, STATUS_INTERRUPTED );
}
bool _POSIX_signals_Unblock_thread(
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index 6423c421b4..657892931e 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -118,7 +118,7 @@ static void _Thread_Remove_timer_and_continue( Thread_Control *the_thread )
#if defined(RTEMS_MULTIPROCESSING)
_Thread_MP_Extract_proxy( the_thread );
#endif
- _Thread_queue_Extract( the_thread );
+ _Thread_Continue( the_thread, STATUS_INTERNAL_ERROR );
}
static void _Thread_Add_to_zombie_registry( Thread_Control *the_thread )
@@ -366,7 +366,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,
--
2.26.2
More information about the devel
mailing list