diff options
Diffstat (limited to 'cpukit/include/rtems/score/threadimpl.h')
-rw-r--r-- | cpukit/include/rtems/score/threadimpl.h | 547 |
1 files changed, 321 insertions, 226 deletions
diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index c861e8b119..36ddb785e9 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + /** * @file * @@ -11,11 +13,28 @@ * COPYRIGHT (c) 1989-2008. * On-Line Applications Research Corporation (OAR). * - * Copyright (c) 2014, 2017 embedded brains GmbH. - * - * The license and distribution terms for this file may be - * found in the file LICENSE in this distribution or at - * http://www.rtems.org/license/LICENSE. + * Copyright (C) 2014, 2017 embedded brains GmbH & Co. KG + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. */ #ifndef _RTEMS_SCORE_THREADIMPL_H @@ -48,9 +67,31 @@ extern "C" { */ /** - * Self for the GNU Ada Run-Time + * @brief The thread zombie registry is used to register threads in the + * #STATES_ZOMBIE state. + */ +typedef struct { +#if defined(RTEMS_SMP) + /** + * @brief This lock protects the zombie chain. + */ + ISR_lock_Control Lock; +#endif + + /** + * @brief This chain contains the registered zombie threads. + */ + Chain_Control Chain; +} Thread_Zombie_registry; + +/** + * @brief This object is a registry for threads in the #STATES_ZOMBIE state. + * + * The registry contains zombie threads waiting to get killed by + * _Thread_Kill_zombies(). Use _Thread_Add_to_zombie_registry() to add zombie + * threads to the registry. */ -extern void *rtems_ada_self; +extern Thread_Zombie_registry _Thread_Zombies; /** * @brief Object identifier of the global constructor thread. @@ -144,7 +185,7 @@ typedef struct { /** * @brief This member contains the handler to free the stack. * - * It shall not be NULL. Use _Stack_Free_nothing() if nothing is to free. + * It shall not be NULL. Use _Objects_Free_nothing() if nothing is to free. */ void ( *stack_free )( void * ); @@ -154,19 +195,9 @@ typedef struct { Priority_Control priority; /** - * @brief The thread's budget algorithm. - */ - Thread_CPU_budget_algorithms budget_algorithm; - - /** - * @brief The thread's initial budget callout. - */ - Thread_CPU_budget_algorithm_callout budget_callout; - - /** - * @brief The thread's initial CPU time budget. + * @brief The thread's initial CPU budget operations. */ - uint32_t cpu_time_budget; + const Thread_CPU_budget_operations *cpu_budget_operations; /** * @brief 32-bit unsigned integer name of the object for the thread. @@ -271,29 +302,19 @@ Status_Control _Thread_Start( ); /** - * @brief Restarts the currently executing thread. - * - * @param[in, out] executing The currently executing thread. - * @param entry The start entry information for @a executing. - * @param lock_context The lock context. - */ -RTEMS_NO_RETURN void _Thread_Restart_self( - Thread_Control *executing, - const Thread_Entry_information *entry, - ISR_lock_Context *lock_context -); - -/** * @brief Restarts the thread. * - * @param[in, out] the_thread The thread to restart. - * @param entry The start entry information for @a the_thread. - * @param lock_context The lock context. + * @param[in, out] the_thread is the thread to restart. + * + * @param entry is the new start entry information for the thread to restart. + * + * @param[in, out] lock_context is the lock context with interrupts disabled. + * + * @retval STATUS_SUCCESSFUL The operation was successful. * - * @retval true The operation was successful. - * @retval false The operation failed. + * @retval STATUS_INCORRECT_STATE The thread was dormant. */ -bool _Thread_Restart_other( +Status_Control _Thread_Restart( Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context @@ -307,18 +328,20 @@ bool _Thread_Restart_other( void _Thread_Yield( Thread_Control *executing ); /** - * @brief Changes the currently executing thread to a new state with the sets. + * @brief Changes the life of currently executing thread. * - * @param clear States to clear. - * @param set States to set. - * @param ignore States to ignore. + * @param life_states_to_clear are the thread life states to clear. * - * @return The previous state the thread was in. + * @param life_states_to_set are the thread life states to set. + * + * @param ignored_life_states are the ignored thread life states. + * + * @return Returns the thread life state before the changes. */ Thread_Life_state _Thread_Change_life( - Thread_Life_state clear, - Thread_Life_state set, - Thread_Life_state ignore + Thread_Life_state life_states_to_clear, + Thread_Life_state life_states_to_set, + Thread_Life_state ignored_life_states ); /** @@ -347,26 +370,33 @@ void _Thread_Kill_zombies( void ); /** * @brief Exits the currently executing thread. * - * @param[in, out] executing The currently executing thread. - * @param set The states to set. - * @param[out] exit_value Contains the exit value of the thread. + * @param exit_value is the exit value of the thread. + * + * @param life_states_to_set are the thread life states to set. */ -void _Thread_Exit( - Thread_Control *executing, - Thread_Life_state set, - void *exit_value +RTEMS_NO_RETURN void _Thread_Exit( + void *exit_value, + Thread_Life_state life_states_to_set ); /** - * @brief Joins the currently executing thread with the given thread to wait - * for. + * @brief Joins the currently executing thread with the thread. * - * @param[in, out] the_thread The thread to wait for. - * @param waiting_for_join The states control for the join. - * @param[in, out] executing The currently executing thread. - * @param queue_context The thread queue context. + * @param[in, out] the_thread is the thread to join. + * + * @param waiting_for_join is the thread state for the currently executing + * thread. + * + * @param[in, out] executing is the currently executing thread. + * + * @param queue_context[in, out] is the thread queue context. The caller shall + * have acquired the thread state lock using the thread queue context. + * + * @retval STATUS_SUCCESSFUL The operation was successful. + * + * @retval STATUS_DEADLOCK A deadlock occurred. */ -void _Thread_Join( +Status_Control _Thread_Join( Thread_Control *the_thread, States_Control waiting_for_join, Thread_Control *executing, @@ -374,23 +404,38 @@ void _Thread_Join( ); /** + * @brief Indicates the resulting state of _Thread_Cancel(). + */ +typedef enum { + /** + * @brief Indicates that the thread cancel operation is done. + */ + THREAD_CANCEL_DONE, + + /** + * @brief Indicates that the thread cancel operation is in progress. + * + * The cancelled thread is terminating. It may be joined. + */ + THREAD_CANCEL_IN_PROGRESS +} Thread_Cancel_state; + +/** * @brief Cancels the thread. * - * @param[in, out] the_thread The thread to cancel. - * @param executing The currently executing thread. - * @param exit_value The exit value for the thread. + * @param[in, out] the_thread is the thread to cancel. + + * @param[in, out] executing is the currently executing thread. + + * @param[in, out] life_states_to_clear is the set of thread life states to + * clear for the thread to cancel. */ -void _Thread_Cancel( - Thread_Control *the_thread, - Thread_Control *executing, - void *exit_value +Thread_Cancel_state _Thread_Cancel( + Thread_Control *the_thread, + Thread_Control *executing, + Thread_Life_state life_states_to_clear ); -typedef struct { - Thread_queue_Context Base; - Thread_Control *cancel; -} Thread_Close_context; - /** * @brief Closes the thread. * @@ -398,14 +443,21 @@ typedef struct { * case the executing thread is not terminated, then this function waits until * the terminating thread reached the zombie state. * - * @param the_thread The thread to close. - * @param executing The currently executing thread. - * @param[in, out] context The thread close context. + * @param the_thread is the thread to close. + * + * @param[in, out] executing is the currently executing thread. + * + * @param[in, out] queue_context is the thread queue context. The caller shall + * have disabled interrupts using the thread queue context. + * + * @retval STATUS_SUCCESSFUL The operation was successful. + * + * @retval STATUS_DEADLOCK A deadlock occurred. */ -void _Thread_Close( +Status_Control _Thread_Close( Thread_Control *the_thread, Thread_Control *executing, - Thread_Close_context *context + Thread_queue_Context *queue_context ); /** @@ -416,7 +468,7 @@ void _Thread_Close( * @retval true The thread is currently in the ready state. * @retval false The thread is currently not ready. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_ready( const Thread_Control *the_thread ) +static inline bool _Thread_Is_ready( const Thread_Control *the_thread ) { return _States_Is_ready( the_thread->current_state ); } @@ -543,7 +595,7 @@ void _Thread_Handler( void ); * @param the_thread The thread to acquire the lock context. * @param lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_State_acquire_critical( +static inline void _Thread_State_acquire_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -557,7 +609,7 @@ RTEMS_INLINE_ROUTINE void _Thread_State_acquire_critical( * @param the_thread The thread to acquire the lock context. * @param lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_State_acquire( +static inline void _Thread_State_acquire( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -574,7 +626,7 @@ RTEMS_INLINE_ROUTINE void _Thread_State_acquire( * * @return The currently executing thread. */ -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_State_acquire_for_executing( +static inline Thread_Control *_Thread_State_acquire_for_executing( ISR_lock_Context *lock_context ) { @@ -593,7 +645,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_State_acquire_for_executing( * @param the_thread The thread to release the lock context. * @param lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_State_release_critical( +static inline void _Thread_State_release_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -607,7 +659,7 @@ RTEMS_INLINE_ROUTINE void _Thread_State_release_critical( * @param[in, out] the_thread The thread to release the lock context. * @param[out] lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_State_release( +static inline void _Thread_State_release( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -625,7 +677,7 @@ RTEMS_INLINE_ROUTINE void _Thread_State_release( * @retval false The thread is not owner of the lock of the join queue. */ #if defined(RTEMS_DEBUG) -RTEMS_INLINE_ROUTINE bool _Thread_State_is_owner( +static inline bool _Thread_State_is_owner( const Thread_Control *the_thread ) { @@ -700,9 +752,10 @@ void _Thread_Priority_remove( * * @param the_thread The thread. * @param[out] priority_node The thread priority node to change. - * @param prepend_it In case this is true, then the thread is prepended to - * its priority group in its home scheduler instance, otherwise it is - * appended. + * @param priority_group_order The priority group order determines if the + * thread is inserted as the first or last node into the ready or scheduled + * queues of its home scheduler, see #PRIORITY_GROUP_FIRST and + * #PRIORITY_GROUP_LAST. * @param queue_context The thread queue context to return an updated set of * threads for _Thread_Priority_update(). The thread queue context must be * initialized via _Thread_queue_Context_clear_priority_updates() before a @@ -713,7 +766,7 @@ void _Thread_Priority_remove( void _Thread_Priority_changed( Thread_Control *the_thread, Priority_Node *priority_node, - bool prepend_it, + Priority_Group_order priority_group_order, Thread_queue_Context *queue_context ); @@ -727,9 +780,10 @@ void _Thread_Priority_changed( * @param[out] priority_node The thread priority node to change. * @param new_priority The new thread priority value of the thread priority * node to change. - * @param prepend_it In case this is true, then the thread is prepended to - * its priority group in its home scheduler instance, otherwise it is - * appended. + * @param priority_group_order The priority group order determines if the + * thread is inserted as the first or last node into the ready or scheduled + * queues of its home scheduler, see #PRIORITY_GROUP_FIRST and + * #PRIORITY_GROUP_LAST. * @param queue_context The thread queue context to return an updated set of * threads for _Thread_Priority_update(). The thread queue context must be * initialized via _Thread_queue_Context_clear_priority_updates() before a @@ -737,11 +791,11 @@ void _Thread_Priority_changed( * * @see _Thread_Wait_acquire(). */ -RTEMS_INLINE_ROUTINE void _Thread_Priority_change( +static inline void _Thread_Priority_change( Thread_Control *the_thread, Priority_Node *priority_node, Priority_Control new_priority, - bool prepend_it, + Priority_Group_order priority_group_order, Thread_queue_Context *queue_context ) { @@ -749,11 +803,12 @@ RTEMS_INLINE_ROUTINE void _Thread_Priority_change( _Thread_Priority_changed( the_thread, priority_node, - prepend_it, + priority_group_order, queue_context ); } +#if defined(RTEMS_SMP) /** * @brief Replaces the victim priority node with the replacement priority node * in the corresponding thread priority aggregation. @@ -771,6 +826,7 @@ void _Thread_Priority_replace( Priority_Node *victim_node, Priority_Node *replacement_node ); +#endif /** * @brief Updates the priority of all threads in the set @@ -785,17 +841,29 @@ void _Thread_Priority_replace( */ void _Thread_Priority_update( Thread_queue_Context *queue_context ); +#if defined(RTEMS_SMP) /** - * @brief Updates the priority of the thread and changes it sticky level. + * @brief Updates the priority of the thread and makes its home scheduler node + * sticky. * - * @param the_thread The thread. - * @param sticky_level_change The new value for the sticky level. + * @param the_thread is the thread to work on. */ -#if defined(RTEMS_SMP) -void _Thread_Priority_and_sticky_update( - Thread_Control *the_thread, - int sticky_level_change -); +void _Thread_Priority_update_and_make_sticky( Thread_Control *the_thread ); + +/** + * @brief Updates the priority of the thread and cleans the sticky property of + * its home scheduler node. + * + * @param the_thread is the thread to work on. + */ +void _Thread_Priority_update_and_clean_sticky( Thread_Control *the_thread ); + +/** + * @brief Updates the priority of the thread. + * + * @param the_thread is the thread to update the priority. + */ +void _Thread_Priority_update_ignore_sticky( Thread_Control *the_thread ); #endif /** @@ -808,7 +876,7 @@ void _Thread_Priority_and_sticky_update( * @retval true The left priority is less in the intuitive sense. * @retval false The left priority is greater or equal in the intuitive sense. */ -RTEMS_INLINE_ROUTINE bool _Thread_Priority_less_than( +static inline bool _Thread_Priority_less_than( Priority_Control left, Priority_Control right ) @@ -825,7 +893,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Priority_less_than( * * @return The highest priority in the intuitive sense of priority. */ -RTEMS_INLINE_ROUTINE Priority_Control _Thread_Priority_highest( +static inline Priority_Control _Thread_Priority_highest( Priority_Control left, Priority_Control right ) @@ -845,7 +913,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Priority_highest( * @return Returns the thread object information associated with the API of the * object identifier. */ -RTEMS_INLINE_ROUTINE Objects_Information *_Thread_Get_objects_information_by_id( +static inline Objects_Information *_Thread_Get_objects_information_by_id( Objects_Id id ) { @@ -873,7 +941,7 @@ RTEMS_INLINE_ROUTINE Objects_Information *_Thread_Get_objects_information_by_id( * * @return Returns the thread object information of the thread. */ -RTEMS_INLINE_ROUTINE Thread_Information *_Thread_Get_objects_information( +static inline Thread_Information *_Thread_Get_objects_information( Thread_Control *the_thread ) { @@ -917,7 +985,7 @@ Objects_Id _Thread_Self_id( void ); * * @return The cpu of the thread's scheduler. */ -RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Get_CPU( +static inline Per_CPU_Control *_Thread_Get_CPU( const Thread_Control *thread ) { @@ -936,7 +1004,7 @@ RTEMS_INLINE_ROUTINE Per_CPU_Control *_Thread_Get_CPU( * @param[out] thread The thread. * @param cpu The cpu to set. */ -RTEMS_INLINE_ROUTINE void _Thread_Set_CPU( +static inline void _Thread_Set_CPU( Thread_Control *thread, Per_CPU_Control *cpu ) @@ -960,7 +1028,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Set_CPU( * @retval true @a the_thread is the currently executing one. * @retval false @a the_thread is not the currently executing one. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_executing ( +static inline bool _Thread_Is_executing ( const Thread_Control *the_thread ) { @@ -980,7 +1048,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing ( * @retval true @a the_thread is the currently executing one. * @retval false @a the_thread is not the currently executing one. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor( +static inline bool _Thread_Is_executing_on_a_processor( const Thread_Control *the_thread ) { @@ -999,7 +1067,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_executing_on_a_processor( * @retval true @a the_thread is the heir. * @retval false @a the_thread is not the heir. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_heir ( +static inline bool _Thread_Is_heir ( const Thread_Control *the_thread ) { @@ -1015,7 +1083,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_heir ( * * @param[in, out] the_thread The thread to unblock. */ -RTEMS_INLINE_ROUTINE void _Thread_Unblock ( +static inline void _Thread_Unblock ( Thread_Control *the_thread ) { @@ -1038,7 +1106,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Unblock ( * loaded in the floating point unit. */ #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp ( +static inline bool _Thread_Is_allocated_fp ( const Thread_Control *the_thread ) { @@ -1064,7 +1132,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp ( * * @param executing The currently executing thread. */ -RTEMS_INLINE_ROUTINE void _Thread_Save_fp( Thread_Control *executing ) +static inline void _Thread_Save_fp( Thread_Control *executing ) { #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE ) @@ -1079,7 +1147,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Save_fp( Thread_Control *executing ) * * @param executing The currently executing thread. */ -RTEMS_INLINE_ROUTINE void _Thread_Restore_fp( Thread_Control *executing ) +static inline void _Thread_Restore_fp( Thread_Control *executing ) { #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) @@ -1104,7 +1172,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Restore_fp( Thread_Control *executing ) * point context is now longer associated with an active thread. */ #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) -RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void ) +static inline void _Thread_Deallocate_fp( void ) { _Thread_Allocated_fp = NULL; } @@ -1119,7 +1187,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp( void ) * @retval true Dispatching is disabled. * @retval false Dispatching is enabled. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void ) +static inline bool _Thread_Is_context_switch_necessary( void ) { return ( _Thread_Dispatch_necessary ); } @@ -1129,7 +1197,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary( void ) * * @return The maximum number of internal threads. */ -RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void) +static inline uint32_t _Thread_Get_maximum_internal_threads(void) { /* Idle threads */ uint32_t maximum_internal_threads = @@ -1151,7 +1219,7 @@ RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void) * @retval pointer Pointer to the allocated Thread_Control. * @retval NULL The operation failed. */ -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void ) +static inline Thread_Control *_Thread_Internal_allocate( void ) { return (Thread_Control *) _Objects_Allocate_unprotected( &_Thread_Information.Objects ); @@ -1170,7 +1238,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Internal_allocate( void ) * @see _Thread_Dispatch(), _Thread_Start_multitasking() and * _Thread_Dispatch_update_heir(). */ -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_heir_and_make_it_executing( +static inline Thread_Control *_Thread_Get_heir_and_make_it_executing( Per_CPU_Control *cpu_self ) { @@ -1190,7 +1258,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Get_heir_and_make_it_executing( * used. * @param cpu The cpu. */ -RTEMS_INLINE_ROUTINE void _Thread_Update_CPU_time_used( +static inline void _Thread_Update_CPU_time_used( Thread_Control *the_thread, Per_CPU_Control *cpu ) @@ -1212,7 +1280,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Update_CPU_time_used( * @param heir The new heir for @a cpu_for_heir. */ #if defined( RTEMS_SMP ) -RTEMS_INLINE_ROUTINE void _Thread_Dispatch_update_heir( +static inline void _Thread_Dispatch_update_heir( Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_for_heir, Thread_Control *heir @@ -1227,15 +1295,41 @@ RTEMS_INLINE_ROUTINE void _Thread_Dispatch_update_heir( #endif /** - * @brief Gets the used cpu time of the thread and stores it in the given - * Timestamp_Control. + * @brief Gets the used processor time of the thread throughout its entire + * lifetime. + * + * @param[in, out] the_thread is the thread. * - * @param the_thread The thread to get the used cpu time of. - * @param[out] cpu_time_used Stores the used cpu time of @a the_thread. + * @return Returns the used processor time of the thread throughout its entire + * lifetime. */ -void _Thread_Get_CPU_time_used( - Thread_Control *the_thread, - Timestamp_Control *cpu_time_used +Timestamp_Control _Thread_Get_CPU_time_used( Thread_Control *the_thread ); + +/** + * @brief Gets the used processor time of the thread throughout its entire + * lifetime if the caller already acquired the thread state and home + * scheduler locks. + * + * @param[in, out] the_thread is the thread. + * + * @return Returns the used processor time of the thread throughout its entire + * lifetime. + */ +Timestamp_Control _Thread_Get_CPU_time_used_locked( + Thread_Control *the_thread +); + +/** + * @brief Gets the used processor time of the thread after the last CPU usage + * reset. + * + * @param[in, out] the_thread is the thread. + * + * @return Returns the used processor time of the thread after the last CPU usage + * reset. + */ +Timestamp_Control _Thread_Get_CPU_time_used_after_last_reset( + Thread_Control *the_thread ); /** @@ -1243,7 +1337,7 @@ void _Thread_Get_CPU_time_used( * * @param[out] action_control The action control to initialize. */ -RTEMS_INLINE_ROUTINE void _Thread_Action_control_initialize( +static inline void _Thread_Action_control_initialize( Thread_Action_control *action_control ) { @@ -1255,7 +1349,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Action_control_initialize( * * @param[out] action The Thread_Action to initialize. */ -RTEMS_INLINE_ROUTINE void _Thread_Action_initialize( +static inline void _Thread_Action_initialize( Thread_Action *action ) { @@ -1274,7 +1368,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Action_initialize( * * @param handler is the handler for the action. */ -RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action( +static inline void _Thread_Add_post_switch_action( Thread_Control *the_thread, Thread_Action *action, Thread_Action_handler handler @@ -1307,7 +1401,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action( * * @param[in, out] action is the action to add. */ -RTEMS_INLINE_ROUTINE void _Thread_Append_post_switch_action( +static inline void _Thread_Append_post_switch_action( Thread_Control *the_thread, Thread_Action *action ) @@ -1329,7 +1423,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Append_post_switch_action( * @retval true @a life_state is restarting. * @retval false @a life_state is not restarting. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_life_restarting( +static inline bool _Thread_Is_life_restarting( Thread_Life_state life_state ) { @@ -1344,7 +1438,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_restarting( * @retval true @a life_state is terminating. * @retval false @a life_state is not terminating. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_life_terminating( +static inline bool _Thread_Is_life_terminating( Thread_Life_state life_state ) { @@ -1359,7 +1453,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_terminating( * @retval true @a life_state allows life change. * @retval false @a life_state does not allow life change. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_life_change_allowed( +static inline bool _Thread_Is_life_change_allowed( Thread_Life_state life_state ) { @@ -1375,7 +1469,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_change_allowed( * @retval true @a life_state is life changing. * @retval false @a life_state is not life changing. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing( +static inline bool _Thread_Is_life_changing( Thread_Life_state life_state ) { @@ -1391,7 +1485,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing( * @retval true @a life_state is joinable. * @retval false @a life_state is not joinable. */ -RTEMS_INLINE_ROUTINE bool _Thread_Is_joinable( +static inline bool _Thread_Is_joinable( const Thread_Control *the_thread ) { @@ -1404,7 +1498,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Is_joinable( * * @param[in, out] the_thread The thread to increase the resource count of. */ -RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment( +static inline void _Thread_Resource_count_increment( Thread_Control *the_thread ) { @@ -1420,7 +1514,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment( * * @param[in, out] the_thread The thread to decrement the resource count of. */ -RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement( +static inline void _Thread_Resource_count_decrement( Thread_Control *the_thread ) { @@ -1443,7 +1537,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement( * @retval true The thread owns resources. * @retval false The thread does not own resources. */ -RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources( +static inline bool _Thread_Owns_resources( const Thread_Control *the_thread ) { @@ -1451,32 +1545,6 @@ RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources( } #endif -#if defined(RTEMS_SMP) -/** - * @brief Cancels the thread's need for help. - * - * @param the_thread The thread to cancel the help request of. - * @param cpu The cpu to get the lock context of in order to - * cancel the help request. - */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_cancel_need_for_help( - Thread_Control *the_thread, - Per_CPU_Control *cpu -) -{ - ISR_lock_Context lock_context; - - _Per_CPU_Acquire( cpu, &lock_context ); - - if ( !_Chain_Is_node_off_chain( &the_thread->Scheduler.Help_node ) ) { - _Chain_Extract_unprotected( &the_thread->Scheduler.Help_node ); - _Chain_Set_off_chain( &the_thread->Scheduler.Help_node ); - } - - _Per_CPU_Release( cpu, &lock_context ); -} -#endif - /** * @brief Gets the home scheduler of the thread. * @@ -1484,7 +1552,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_cancel_need_for_help( * * @return The thread's home scheduler. */ -RTEMS_INLINE_ROUTINE const Scheduler_Control *_Thread_Scheduler_get_home( +static inline const Scheduler_Control *_Thread_Scheduler_get_home( const Thread_Control *the_thread ) { @@ -1503,7 +1571,7 @@ RTEMS_INLINE_ROUTINE const Scheduler_Control *_Thread_Scheduler_get_home( * * @return The thread's home node. */ -RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_home_node( +static inline Scheduler_Node *_Thread_Scheduler_get_home_node( const Thread_Control *the_thread ) { @@ -1525,17 +1593,17 @@ RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_home_node( * * @return The scheduler node with the specified index. */ -RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_node_by_index( +static inline Scheduler_Node *_Thread_Scheduler_get_node_by_index( const Thread_Control *the_thread, size_t scheduler_index ) { + _Assert( scheduler_index < _Scheduler_Count ); #if defined(RTEMS_SMP) return (Scheduler_Node *) ( (uintptr_t) the_thread->Scheduler.nodes + scheduler_index * _Scheduler_Node_size ); #else - _Assert( scheduler_index == 0 ); (void) scheduler_index; return the_thread->Scheduler.nodes; #endif @@ -1548,7 +1616,7 @@ RTEMS_INLINE_ROUTINE Scheduler_Node *_Thread_Scheduler_get_node_by_index( * @param the_thread The thread to acquire the lock context. * @param lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_acquire_critical( +static inline void _Thread_Scheduler_acquire_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1562,7 +1630,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_acquire_critical( * @param the_thread The thread to release the lock context. * @param lock_context The lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_release_critical( +static inline void _Thread_Scheduler_release_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1584,7 +1652,7 @@ void _Thread_Scheduler_process_requests( Thread_Control *the_thread ); * @param[in, out] scheduler_node The scheduler node for the request. * @param request The request to add. */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_request( +static inline void _Thread_Scheduler_add_request( Thread_Control *the_thread, Scheduler_Node *scheduler_node, Scheduler_Node_request request @@ -1627,7 +1695,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_request( * @param[in, out] the_thread The thread to add the wait node to. * @param scheduler_node The scheduler node which provides the wait node. */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_wait_node( +static inline void _Thread_Scheduler_add_wait_node( Thread_Control *the_thread, Scheduler_Node *scheduler_node ) @@ -1650,7 +1718,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_add_wait_node( * @param the_thread The thread to add the request to remove a wait node. * @param scheduler_node The scheduler node to remove a wait node from. */ -RTEMS_INLINE_ROUTINE void _Thread_Scheduler_remove_wait_node( +static inline void _Thread_Scheduler_remove_wait_node( Thread_Control *the_thread, Scheduler_Node *scheduler_node ) @@ -1675,7 +1743,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Scheduler_remove_wait_node( * * @return The priority of the thread. */ -RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority( +static inline Priority_Control _Thread_Get_priority( const Thread_Control *the_thread ) { @@ -1692,7 +1760,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority( * * @return The unmapped priority of the thread. */ -RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_priority( +static inline Priority_Control _Thread_Get_unmapped_priority( const Thread_Control *the_thread ) { @@ -1706,7 +1774,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_priority( * * @return The unmapped real priority of the thread. */ -RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_real_priority( +static inline Priority_Control _Thread_Get_unmapped_real_priority( const Thread_Control *the_thread ) { @@ -1723,7 +1791,7 @@ RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_real_priority( * * @see _Thread_Wait_release_default_critical(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default_critical( +static inline void _Thread_Wait_acquire_default_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1742,7 +1810,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default_critical( * * @see _Thread_Wait_release_default(). */ -RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Wait_acquire_default_for_executing( +static inline Thread_Control *_Thread_Wait_acquire_default_for_executing( ISR_lock_Context *lock_context ) { @@ -1764,7 +1832,7 @@ RTEMS_INLINE_ROUTINE Thread_Control *_Thread_Wait_acquire_default_for_executing( * * @see _Thread_Wait_release_default(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default( +static inline void _Thread_Wait_acquire_default( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1783,7 +1851,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default( * @param lock_context The lock context used for the corresponding lock * acquire. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default_critical( +static inline void _Thread_Wait_release_default_critical( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1799,7 +1867,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default_critical( * @param[out] lock_context The lock context used for the corresponding lock * acquire. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default( +static inline void _Thread_Wait_release_default( Thread_Control *the_thread, ISR_lock_Context *lock_context ) @@ -1818,7 +1886,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default( * @param the_thread The thread to remove the request from. * @param queue_lock_context The queue lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request_locked( +static inline void _Thread_Wait_remove_request_locked( Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context ) @@ -1839,7 +1907,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request_locked( * @param queue The queue that acquires. * @param queue_lock_context The queue lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_queue_critical( +static inline void _Thread_Wait_acquire_queue_critical( Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context ) @@ -1857,7 +1925,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_queue_critical( * @param queue The queue that releases. * @param queue_lock_context The queue lock context. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_release_queue_critical( +static inline void _Thread_Wait_release_queue_critical( Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context ) @@ -1877,7 +1945,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_release_queue_critical( * @param[in, out] queue_context The thread queue context for the corresponding * _Thread_Wait_release_critical(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_critical( +static inline void _Thread_Wait_acquire_critical( Thread_Control *the_thread, Thread_queue_Context *queue_context ) @@ -1933,7 +2001,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_critical( * @param[in, out] queue_context The thread queue context for the corresponding * _Thread_Wait_release(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire( +static inline void _Thread_Wait_acquire( Thread_Control *the_thread, Thread_queue_Context *queue_context ) @@ -1952,7 +2020,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire( * @param[in, out] queue_context The thread queue context used for corresponding * _Thread_Wait_acquire_critical(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_release_critical( +static inline void _Thread_Wait_release_critical( Thread_Control *the_thread, Thread_queue_Context *queue_context ) @@ -1994,7 +2062,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_release_critical( * @param[in, out] queue_context The thread queue context used for corresponding * _Thread_Wait_acquire(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_release( +static inline void _Thread_Wait_release( Thread_Control *the_thread, Thread_queue_Context *queue_context ) @@ -2017,7 +2085,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_release( * * @see _Thread_Wait_claim_finalize() and _Thread_Wait_restore_default(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_claim( +static inline void _Thread_Wait_claim( Thread_Control *the_thread, Thread_queue_Queue *queue ) @@ -2046,7 +2114,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_claim( * @param[in, out] the_thread The thread. * @param operations The corresponding thread queue operations. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_claim_finalize( +static inline void _Thread_Wait_claim_finalize( Thread_Control *the_thread, const Thread_queue_Operations *operations ) @@ -2065,7 +2133,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_claim_finalize( * @param[in, out] queue_lock_context The thread queue lock context used for * corresponding _Thread_Wait_acquire(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request( +static inline void _Thread_Wait_remove_request( Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context ) @@ -2094,7 +2162,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request( * * @see _Thread_Wait_claim(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default( +static inline void _Thread_Wait_restore_default( Thread_Control *the_thread ) { @@ -2153,7 +2221,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default( * * @param the_thread The thread. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_tranquilize( +static inline void _Thread_Wait_tranquilize( Thread_Control *the_thread ) { @@ -2171,7 +2239,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_tranquilize( * @param queue_context The thread queue context used for corresponding * _Thread_Wait_acquire(). */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel( +static inline void _Thread_Wait_cancel( Thread_Control *the_thread, Thread_queue_Context *queue_context ) @@ -2180,8 +2248,8 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel( queue = the_thread->Wait.queue; -#if defined(RTEMS_SMP) if ( queue != NULL ) { +#if defined(RTEMS_SMP) _Assert( queue_context->Lock_context.Wait.queue == queue ); #endif @@ -2195,19 +2263,23 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel( #if defined(RTEMS_SMP) _Assert( queue_context->Lock_context.Wait.queue == NULL ); queue_context->Lock_context.Wait.queue = queue; - } #endif + } } /** - * @brief The initial thread wait flags value set by _Thread_Initialize(). + * @brief Mask to get the thread wait state flags. */ -#define THREAD_WAIT_FLAGS_INITIAL 0x0U +#define THREAD_WAIT_STATE_MASK 0xffU /** - * @brief Mask to get the thread wait state flags. + * @brief Indicates that the thread does not wait on something. + * + * In this wait state, the wait class is zero. This wait state is set + * initially by _Thread_Initialize() and after each wait operation once the + * thread is ready again. */ -#define THREAD_WAIT_STATE_MASK 0xffU +#define THREAD_WAIT_STATE_READY 0x0U /** * @brief Indicates that the thread begins with the blocking operation. @@ -2224,13 +2296,6 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel( #define THREAD_WAIT_STATE_BLOCKED 0x2U /** - * @brief Indicates that a condition to end the thread wait occurred. - * - * This could be a timeout, a signal, an event or a resource availability. - */ -#define THREAD_WAIT_STATE_READY_AGAIN 0x4U - -/** * @brief Mask to get the thread wait class flags. */ #define THREAD_WAIT_CLASS_MASK 0xff00U @@ -2261,7 +2326,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel( * @param[in, out] the_thread The thread to set the wait flags of. * @param flags The flags to set. */ -RTEMS_INLINE_ROUTINE void _Thread_Wait_flags_set( +static inline void _Thread_Wait_flags_set( Thread_Control *the_thread, Thread_Wait_flags flags ) @@ -2280,7 +2345,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Wait_flags_set( * * @return The thread's wait flags. */ -RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get( +static inline Thread_Wait_flags _Thread_Wait_flags_get( const Thread_Control *the_thread ) { @@ -2298,7 +2363,7 @@ RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get( * * @return The thread's wait flags. */ -RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get_acquire( +static inline Thread_Wait_flags _Thread_Wait_flags_get_acquire( const Thread_Control *the_thread ) { @@ -2325,7 +2390,7 @@ RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get_acquire( * @retval true The wait flags were equal to the expected wait flags. * @retval false The wait flags were not equal to the expected wait flags. */ -RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_release( +static inline bool _Thread_Wait_flags_try_change_release( Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags @@ -2365,7 +2430,7 @@ RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_release( * @retval true The wait flags were equal to the expected wait flags. * @retval false The wait flags were not equal to the expected wait flags. */ -RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_acquire( +static inline bool _Thread_Wait_flags_try_change_acquire( Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags @@ -2419,7 +2484,7 @@ Objects_Id _Thread_Wait_get_id( const Thread_Control *the_thread ); * * @param the_thread The thread to get the status of the wait return code of. */ -RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status( +static inline Status_Control _Thread_Wait_get_status( const Thread_Control *the_thread ) { @@ -2453,7 +2518,7 @@ void _Thread_Timeout( Watchdog_Control *the_watchdog ); * @param [in, out] timer The timer to initialize. * @param cpu The cpu for the operation. */ -RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize( +static inline void _Thread_Timer_initialize( Thread_Timer_information *timer, Per_CPU_Control *cpu ) @@ -2470,7 +2535,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize( * @param cpu The cpu for the operation. * @param ticks The ticks to add to the timeout ticks. */ -RTEMS_INLINE_ROUTINE void _Thread_Add_timeout_ticks( +static inline void _Thread_Add_timeout_ticks( Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks @@ -2496,7 +2561,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Add_timeout_ticks( * @param routine The watchdog routine for the thread. * @param expire Expiration for the watchdog. */ -RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_realtime( +static inline void _Thread_Timer_insert_realtime( Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Service_routine_entry routine, @@ -2521,7 +2586,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_realtime( * * @param[in, out] the_thread The thread to remove the watchdog from. */ -RTEMS_INLINE_ROUTINE void _Thread_Timer_remove( Thread_Control *the_thread ) +static inline void _Thread_Timer_remove( Thread_Control *the_thread ) { ISR_lock_Context lock_context; @@ -2547,7 +2612,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Timer_remove( Thread_Control *the_thread ) * if necessary. * @param queue The thread queue. */ -RTEMS_INLINE_ROUTINE void _Thread_Remove_timer_and_unblock( +static inline void _Thread_Remove_timer_and_unblock( Thread_Control *the_thread, Thread_queue_Queue *queue ) @@ -2618,10 +2683,10 @@ void _Thread_Do_unpin( * * @param executing The currently executing thread. */ -RTEMS_INLINE_ROUTINE void _Thread_Pin( Thread_Control *executing ) +static inline void _Thread_Pin( Thread_Control *executing ) { #if defined(RTEMS_SMP) - _Assert( executing == _Thread_Executing ); + _Assert( executing == _Thread_Get_executing() ); executing->Scheduler.pin_level += THREAD_PIN_STEP; #else @@ -2635,7 +2700,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Pin( Thread_Control *executing ) * @param executing The currently executing thread. * @param cpu_self The cpu for the operation. */ -RTEMS_INLINE_ROUTINE void _Thread_Unpin( +static inline void _Thread_Unpin( Thread_Control *executing, Per_CPU_Control *cpu_self ) @@ -2643,7 +2708,7 @@ RTEMS_INLINE_ROUTINE void _Thread_Unpin( #if defined(RTEMS_SMP) unsigned int pin_level; - _Assert( executing == _Thread_Executing ); + _Assert( executing == _Per_CPU_Get_executing( cpu_self ) ); pin_level = executing->Scheduler.pin_level; _Assert( pin_level > 0 ); @@ -2673,5 +2738,35 @@ RTEMS_INLINE_ROUTINE void _Thread_Unpin( #include <rtems/score/threadmp.h> #endif +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @ingroup RTEMSScoreThread + * + * @brief Removes the watchdog timer from the thread and lets the thread + * continue its execution. + * + * @param[in, out] the_thread is the thread. + * + * @param status is the thread wait status. + */ +static inline void _Thread_Timer_remove_and_continue( + Thread_Control *the_thread, + Status_Control status +) +{ + _Thread_Timer_remove( the_thread ); +#if defined(RTEMS_MULTIPROCESSING) + _Thread_MP_Extract_proxy( the_thread ); +#endif + _Thread_Continue( the_thread, status ); +} + +#ifdef __cplusplus +} +#endif + #endif /* end of include file */ |