summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadrestart.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2021-01-27 19:28:56 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2021-02-01 06:22:19 +0100
commitbf8d4b94793eaf6e8ba1c694fcdb2885d75d61e3 (patch)
tree527838aa6c399ebd3e3e376af48068bf30f08bce /cpukit/score/src/threadrestart.c
parentscore: Rename _Thread_Get_objects_information() (diff)
downloadrtems-bf8d4b94793eaf6e8ba1c694fcdb2885d75d61e3.tar.bz2
score: Add _Thread_Get_objects_information()
We do not need all the checks if we have a valid indentifier to a thread class object. Using the new _Thread_Get_objects_information() instead of the inline function _Thread_Get_objects_information_by_id() avoids dead code since the identifier in a thread control is always valid and the return NULL path in _Thread_Get_objects_information_by_id() would be dead code. The _Thread_Get_objects_information_by_id() should be an inline function since it is used by _Thread_Get() and thus performance critical. Static analyzers which cannot derive that the identifier in a thread control is always valid, may find a potential NULL pointer access (or otherwise find dead code). The identifier in an object control is always valid, see _Objects_Initialize_information() and _Objects_Extend_information(). Move _RTEMS_tasks_Free() to the only source file which calls this function.
Diffstat (limited to 'cpukit/score/src/threadrestart.c')
-rw-r--r--cpukit/score/src/threadrestart.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c
index b4204f7fbb..cf92e25a5d 100644
--- a/cpukit/score/src/threadrestart.c
+++ b/cpukit/score/src/threadrestart.c
@@ -130,16 +130,16 @@ static void _Thread_Add_to_zombie_chain( Thread_Control *the_thread )
static void _Thread_Make_zombie( Thread_Control *the_thread )
{
+ Thread_Information *information;
+
#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
if ( _Thread_Owns_resources( the_thread ) ) {
_Internal_error( INTERNAL_ERROR_RESOURCE_IN_USE );
}
#endif
- _Objects_Close(
- _Objects_Get_information_id( the_thread->Object.id ),
- &the_thread->Object
- );
+ information = _Thread_Get_objects_information( the_thread );
+ _Objects_Close( &information->Objects, &the_thread->Object );
_Thread_Set_state( the_thread, STATES_ZOMBIE );
_Thread_queue_Extract_with_proxy( the_thread );
@@ -157,8 +157,7 @@ static void _Thread_Make_zombie( Thread_Control *the_thread )
static void _Thread_Free( Thread_Control *the_thread )
{
- Thread_Information *information = (Thread_Information *)
- _Objects_Get_information_id( the_thread->Object.id );
+ Thread_Information *information;
_User_extensions_Thread_delete( the_thread );
_User_extensions_Destroy_iterators( the_thread );
@@ -179,6 +178,7 @@ static void _Thread_Free( Thread_Control *the_thread )
#endif
#endif
+ information = _Thread_Get_objects_information( the_thread );
_Freechain_Push(
&information->Thread_queue_heads.Free,
the_thread->Wait.spare_heads