diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-01-27 19:28:56 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2021-02-01 06:22:19 +0100 |
commit | bf8d4b94793eaf6e8ba1c694fcdb2885d75d61e3 (patch) | |
tree | 527838aa6c399ebd3e3e376af48068bf30f08bce /cpukit/include/rtems/score/threadimpl.h | |
parent | score: Rename _Thread_Get_objects_information() (diff) | |
download | rtems-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/include/rtems/score/threadimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/threadimpl.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index d5381c9871..e76f9c3972 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -847,6 +847,30 @@ RTEMS_INLINE_ROUTINE Objects_Information *_Thread_Get_objects_information_by_id( } /** + * @brief Gets the thread object information of the thread. + * + * @param the_thread is the thread to get the thread object information. + * + * @return Returns the thread object information of the thread. + */ +RTEMS_INLINE_ROUTINE Thread_Information *_Thread_Get_objects_information( + Thread_Control *the_thread +) +{ + size_t the_api; + Thread_Information *information; + + the_api = (size_t) _Objects_Get_API( the_thread->Object.id ); + _Assert( _Objects_Is_api_valid( the_api ) ); + + information = (Thread_Information *) + _Objects_Information_table[ the_api ][ 1 ]; + _Assert( information != NULL ); + + return information; +} + +/** * @brief Gets a thread by its identifier. * * @see _Objects_Get(). |