40#ifndef _RTEMS_SCORE_THREADIMPL_H
41#define _RTEMS_SCORE_THREADIMPL_H
57#include <rtems/config.h>
78 ISR_lock_Control Lock;
110#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
114#if defined(RTEMS_SMP)
115#define THREAD_OF_SCHEDULER_HELP_NODE( node ) \
116 RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node )
119typedef bool ( *Thread_Visitor )(
Thread_Control *the_thread,
void *arg );
130 Thread_Visitor visitor,
190 void ( *stack_free )(
void * );
471static inline bool _Thread_Is_ready(
const Thread_Control *the_thread )
598static inline void _Thread_State_acquire_critical(
603 _Thread_queue_Do_acquire_critical( &the_thread->
Join_queue, lock_context );
612static inline void _Thread_State_acquire(
618 _Thread_State_acquire_critical( the_thread, lock_context );
636 executing = _Thread_Executing;
637 _Thread_State_acquire_critical( executing, lock_context );
648static inline void _Thread_State_release_critical(
653 _Thread_queue_Do_release_critical( &the_thread->
Join_queue, lock_context );
662static inline void _Thread_State_release(
667 _Thread_State_release_critical( the_thread, lock_context );
679#if defined(RTEMS_DEBUG)
680static inline bool _Thread_State_is_owner(
684 return _Thread_queue_Is_lock_owner( &the_thread->
Join_queue );
794static inline void _Thread_Priority_change(
802 _Priority_Node_set_priority( priority_node, new_priority );
804#if defined(RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE)
805 if ( !_Priority_Node_is_active( priority_node ) ) {
814 priority_group_order,
819#if defined(RTEMS_SMP)
832void _Thread_Priority_replace(
852#if defined(RTEMS_SMP)
859void _Thread_Priority_update_and_make_sticky(
Thread_Control *the_thread );
867void _Thread_Priority_update_and_clean_sticky(
Thread_Control *the_thread );
874void _Thread_Priority_update_ignore_sticky(
Thread_Control *the_thread );
887static inline bool _Thread_Priority_less_than(
909 return _Thread_Priority_less_than( left, right ) ? right : left;
930 the_api = _Objects_Get_API(
id );
932 if ( !_Objects_Is_api_valid( the_api ) ) {
959 the_api = (size_t) _Objects_Get_API( the_thread->
Object.
id );
960 _Assert( _Objects_Is_api_valid( the_api ) );
964 _Assert( information != NULL );
1000#if defined(RTEMS_SMP)
1005 return _Per_CPU_Get();
1015static inline void _Thread_Set_CPU(
1020#if defined(RTEMS_SMP)
1039static inline bool _Thread_Is_executing (
1043 return ( the_thread == _Thread_Executing );
1046#if defined(RTEMS_SMP)
1059static inline bool _Thread_Is_executing_on_a_processor(
1063 return _CPU_Context_Get_is_executing( &the_thread->
Registers );
1078static inline bool _Thread_Is_heir (
1082 return ( the_thread == _Thread_Heir );
1094static inline void _Thread_Unblock (
1116#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1117static inline bool _Thread_Is_allocated_fp (
1145#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1146#if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE )
1158static inline void _Thread_Restore_fp(
Thread_Control *executing )
1160#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1161#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
1163 !_Thread_Is_allocated_fp( executing ) ) {
1182#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1183static inline void _Thread_Deallocate_fp(
void )
1198static inline bool _Thread_Is_context_switch_necessary(
void )
1200 return ( _Thread_Dispatch_necessary );
1208static inline uint32_t _Thread_Get_maximum_internal_threads(
void)
1211 uint32_t maximum_internal_threads =
1215#if defined(RTEMS_MULTIPROCESSING)
1216 if ( _System_state_Is_multiprocessing ) {
1217 ++maximum_internal_threads;
1221 return maximum_internal_threads;
1249static inline Thread_Control *_Thread_Get_heir_and_make_it_executing(
1255 heir = cpu_self->
heir;
1269static inline void _Thread_Update_CPU_time_used(
1290#if defined( RTEMS_SMP )
1291static inline void _Thread_Dispatch_update_heir(
1297 _Thread_Update_CPU_time_used( cpu_for_heir->
heir, cpu_for_heir );
1299 cpu_for_heir->
heir = heir;
1301 _Thread_Dispatch_request( cpu_self, cpu_for_heir );
1348static inline void _Thread_Action_control_initialize(
1352 _Chain_Initialize_empty( &action_control->Chain );
1360static inline void _Thread_Action_initialize(
1364 _Chain_Set_off_chain( &action->Node );
1379static inline void _Thread_Add_post_switch_action(
1387 _Assert( _Thread_State_is_owner( the_thread ) );
1389 cpu_of_thread = _Thread_Get_CPU( the_thread );
1391 action->handler = handler;
1393 _Thread_Dispatch_request( _Per_CPU_Get(), cpu_of_thread );
1395 _Chain_Append_if_is_off_chain_unprotected(
1396 &the_thread->Post_switch_actions.Chain,
1412static inline void _Thread_Append_post_switch_action(
1417 _Assert( _Thread_State_is_owner( the_thread ) );
1418 _Assert( action->handler != NULL );
1420 _Chain_Append_unprotected(
1421 &the_thread->Post_switch_actions.Chain,
1434static inline bool _Thread_Is_life_restarting(
1449static inline bool _Thread_Is_life_terminating(
1464static inline bool _Thread_Is_life_change_allowed(
1480static inline bool _Thread_Is_life_changing(
1496static inline bool _Thread_Is_joinable(
1500 _Assert( _Thread_State_is_owner( the_thread ) );
1509static inline void _Thread_Resource_count_increment(
1513#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1514 ++the_thread->resource_count;
1525static inline void _Thread_Resource_count_decrement(
1529#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1530 --the_thread->resource_count;
1536#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1548static inline bool _Thread_Owns_resources(
1552 return the_thread->resource_count != 0;
1567#if defined(RTEMS_SMP)
1568 return the_thread->
Scheduler.home_scheduler;
1586#if defined(RTEMS_SMP)
1588 return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1589 _Chain_First( &the_thread->
Scheduler.Wait_nodes )
1604static inline Scheduler_Node *_Thread_Scheduler_get_node_by_index(
1606 size_t scheduler_index
1610#if defined(RTEMS_SMP)
1613 + scheduler_index * _Scheduler_Node_size );
1615 (void) scheduler_index;
1620#if defined(RTEMS_SMP)
1627static inline void _Thread_Scheduler_acquire_critical(
1641static inline void _Thread_Scheduler_release_critical(
1654void _Thread_Scheduler_process_requests(
Thread_Control *the_thread );
1663static inline void _Thread_Scheduler_add_request(
1666 Scheduler_Node_request request
1670 Scheduler_Node_request current_request;
1672 _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1674 current_request = scheduler_node->Thread.request;
1676 if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1678 request == SCHEDULER_NODE_REQUEST_ADD
1679 || request == SCHEDULER_NODE_REQUEST_REMOVE
1681 _Assert( scheduler_node->Thread.next_request == NULL );
1682 scheduler_node->Thread.next_request = the_thread->
Scheduler.requests;
1683 the_thread->
Scheduler.requests = scheduler_node;
1684 }
else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1686 ( current_request == SCHEDULER_NODE_REQUEST_ADD
1687 && request == SCHEDULER_NODE_REQUEST_REMOVE )
1688 || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1689 && request == SCHEDULER_NODE_REQUEST_ADD )
1691 request = SCHEDULER_NODE_REQUEST_NOTHING;
1694 scheduler_node->Thread.request = request;
1696 _Thread_Scheduler_release_critical( the_thread, &lock_context );
1706static inline void _Thread_Scheduler_add_wait_node(
1711 _Chain_Append_unprotected(
1713 &scheduler_node->Thread.Wait_node
1715 _Thread_Scheduler_add_request(
1718 SCHEDULER_NODE_REQUEST_ADD
1729static inline void _Thread_Scheduler_remove_wait_node(
1734 _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
1735 _Thread_Scheduler_add_request(
1738 SCHEDULER_NODE_REQUEST_REMOVE
1760 scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
1761 return _Priority_Get_priority( &scheduler_node->
Wait.Priority );
1802static inline void _Thread_Wait_acquire_default_critical(
1821static inline Thread_Control *_Thread_Wait_acquire_default_for_executing(
1828 executing = _Thread_Executing;
1829 _Thread_Wait_acquire_default_critical( executing, lock_context );
1843static inline void _Thread_Wait_acquire_default(
1849 _Thread_Wait_acquire_default_critical( the_thread, lock_context );
1862static inline void _Thread_Wait_release_default_critical(
1878static inline void _Thread_Wait_release_default(
1883 _Thread_Wait_release_default_critical( the_thread, lock_context );
1887#if defined(RTEMS_SMP)
1888#define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
1889 RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
1897static inline void _Thread_Wait_remove_request_locked(
1904 _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
1905 first = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
1907 if ( first != _Chain_Tail( &the_thread->
Wait.Lock.Pending_requests ) ) {
1908 _Thread_queue_Gate_open( (Thread_queue_Gate *) first );
1918static inline void _Thread_Wait_acquire_queue_critical(
1923 _Thread_queue_Queue_acquire_critical(
1925 &_Thread_Executing->Potpourri_stats,
1936static inline void _Thread_Wait_release_queue_critical(
1941 _Thread_queue_Queue_release_critical(
1956static inline void _Thread_Wait_acquire_critical(
1961#if defined(RTEMS_SMP)
1964 _Thread_Wait_acquire_default_critical(
1972 if ( queue != NULL ) {
1973 _Thread_queue_Gate_add(
1974 &the_thread->
Wait.Lock.Pending_requests,
1977 _Thread_Wait_release_default_critical(
1981 _Thread_Wait_acquire_queue_critical( queue, &queue_context->
Lock_context );
1983 if ( queue_context->
Lock_context.Wait.queue == NULL ) {
1984 _Thread_Wait_release_queue_critical(
1988 _Thread_Wait_acquire_default_critical(
1992 _Thread_Wait_remove_request_locked(
2001 (void) queue_context;
2012static inline void _Thread_Wait_acquire(
2018 _Thread_Wait_acquire_critical( the_thread, queue_context );
2031static inline void _Thread_Wait_release_critical(
2036#if defined(RTEMS_SMP)
2041 if ( queue != NULL ) {
2042 _Thread_Wait_release_queue_critical(
2045 _Thread_Wait_acquire_default_critical(
2049 _Thread_Wait_remove_request_locked(
2055 _Thread_Wait_release_default_critical(
2061 (void) queue_context;
2073static inline void _Thread_Wait_release(
2078 _Thread_Wait_release_critical( the_thread, queue_context );
2096static inline void _Thread_Wait_claim(
2103 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2107#if defined(RTEMS_SMP)
2108 _Chain_Initialize_empty( &the_thread->
Wait.Lock.Pending_requests );
2109 _Chain_Initialize_node( &the_thread->
Wait.Lock.Tranquilizer.Node );
2110 _Thread_queue_Gate_close( &the_thread->
Wait.Lock.Tranquilizer );
2115 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2125static inline void _Thread_Wait_claim_finalize(
2144static inline void _Thread_Wait_remove_request(
2149#if defined(RTEMS_SMP)
2152 _Thread_Wait_acquire_default( the_thread, &lock_context );
2153 _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
2154 _Thread_Wait_release_default( the_thread, &lock_context );
2157 (void) queue_lock_context;
2173static inline void _Thread_Wait_restore_default(
2177#if defined(RTEMS_SMP)
2182 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2184 node = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
2185 tail = _Chain_Immutable_tail( &the_thread->
Wait.Lock.Pending_requests );
2187 if ( node != tail ) {
2191 queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2194 node = _Chain_Next( node );
2195 }
while ( node != tail );
2197 _Thread_queue_Gate_add(
2198 &the_thread->
Wait.Lock.Pending_requests,
2199 &the_thread->
Wait.Lock.Tranquilizer
2202 _Thread_queue_Gate_open( &the_thread->
Wait.Lock.Tranquilizer );
2209#if defined(RTEMS_SMP)
2210 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2232static inline void _Thread_Wait_tranquilize(
2236#if defined(RTEMS_SMP)
2237 _Thread_queue_Gate_wait( &the_thread->
Wait.Lock.Tranquilizer );
2250static inline void _Thread_Wait_cancel(
2259 if ( queue != NULL ) {
2260#if defined(RTEMS_SMP)
2269 _Thread_Wait_restore_default( the_thread );
2271#if defined(RTEMS_SMP)
2281#define THREAD_WAIT_STATE_MASK 0xffU
2290#define THREAD_WAIT_STATE_READY 0x0U
2299#define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U
2304#define THREAD_WAIT_STATE_BLOCKED 0x2U
2309#define THREAD_WAIT_CLASS_MASK 0xff00U
2314#define THREAD_WAIT_CLASS_EVENT 0x100U
2319#define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U
2324#define THREAD_WAIT_CLASS_OBJECT 0x400U
2329#define THREAD_WAIT_CLASS_PERIOD 0x800U
2337static inline void _Thread_Wait_flags_set(
2342#if defined(RTEMS_SMP)
2343 _Atomic_Store_uint( &the_thread->
Wait.
flags, flags, ATOMIC_ORDER_RELAXED );
2360#if defined(RTEMS_SMP)
2361 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_RELAXED );
2378#if defined(RTEMS_SMP)
2379 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_ACQUIRE );
2401static inline bool _Thread_Wait_flags_try_change_release(
2409#if defined(RTEMS_SMP)
2410 return _Atomic_Compare_exchange_uint(
2414 ATOMIC_ORDER_RELEASE,
2415 ATOMIC_ORDER_RELAXED
2418 bool success = ( the_thread->
Wait.
flags == expected_flags );
2441static inline bool _Thread_Wait_flags_try_change_acquire(
2447#if defined(RTEMS_SMP)
2448 return _Atomic_Compare_exchange_uint(
2452 ATOMIC_ORDER_ACQUIRE,
2453 ATOMIC_ORDER_ACQUIRE
2461 success = _Thread_Wait_flags_try_change_release(
2529static inline void _Thread_Timer_initialize(
2536 _Watchdog_Preinitialize( &timer->Watchdog, cpu );
2546static inline void _Thread_Add_timeout_ticks(
2556 the_thread->
Timer.header =
2559 _Watchdog_Per_CPU_insert_ticks( &the_thread->
Timer.Watchdog, cpu, ticks );
2572static inline void _Thread_Timer_insert_realtime(
2585 the_thread->
Timer.header = header;
2587 _Watchdog_Per_CPU_insert( &the_thread->
Timer.Watchdog, cpu, header, expire );
2597static inline void _Thread_Timer_remove(
Thread_Control *the_thread )
2603 _Watchdog_Per_CPU_remove(
2604 &the_thread->
Timer.Watchdog,
2605#
if defined(RTEMS_SMP)
2606 the_thread->
Timer.Watchdog.cpu,
2610 the_thread->
Timer.header
2623static inline void _Thread_Remove_timer_and_unblock(
2628 _Thread_Wait_tranquilize( the_thread );
2629 _Thread_Timer_remove( the_thread );
2631#if defined(RTEMS_MULTIPROCESSING)
2632 if ( _Objects_Is_local_id( the_thread->
Object.
id ) ) {
2633 _Thread_Unblock( the_thread );
2635 _Thread_queue_Unblock_proxy( queue, the_thread );
2639 _Thread_Unblock( the_thread );
2672#if defined(RTEMS_SMP)
2673#define THREAD_PIN_STEP 2
2675#define THREAD_PIN_PREEMPTION 1
2683void _Thread_Do_unpin(
2696#if defined(RTEMS_SMP)
2697 _Assert( executing == _Thread_Get_executing() );
2699 executing->
Scheduler.pin_level += THREAD_PIN_STEP;
2711static inline void _Thread_Unpin(
2716#if defined(RTEMS_SMP)
2717 unsigned int pin_level;
2719 _Assert( executing == _Per_CPU_Get_executing( cpu_self ) );
2721 pin_level = executing->
Scheduler.pin_level;
2726 pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2729 executing->
Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2731 _Thread_Do_unpin( executing, cpu_self );
2745#if defined(RTEMS_MULTIPROCESSING)
2763static inline void _Thread_Timer_remove_and_continue(
2768 _Thread_Timer_remove( the_thread );
2769#if defined(RTEMS_MULTIPROCESSING)
This header file provides the interfaces of the Assert Handler.
This header file provides interfaces of the Chain Handler which are only used by the implementation.
#define RTEMS_PREDICT_TRUE(_exp)
Evaluates the integral expression and tells the compiler that the predicted value is true (1).
Definition: basedefs.h:751
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
#define rtems_configuration_get_maximum_processors()
Gets the maximum number of processors configured for this application.
Definition: config.h:500
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
#define _Context_Restore_fp(_fp)
Restore floating point context area.
Definition: context.h:159
#define _Context_Save_fp(_fp)
Save floating point context area.
Definition: context.h:170
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:385
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:282
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:364
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:259
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:229
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
Definition: isrlock.h:204
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:150
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
Definition: isrlevel.h:76
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:93
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:147
uint32_t ISR_Level
Definition: isrlevel.h:60
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
uint32_t Objects_Id
Definition: object.h:101
@ PER_CPU_WATCHDOG_REALTIME
Index for realtime clock per-CPU watchdog header.
Definition: percpu.h:362
@ PER_CPU_WATCHDOG_TICKS
Index for tick clock per-CPU watchdog header.
Definition: percpu.h:353
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
Priority_Group_order
The priority group order determines if a priority node is inserted as the first or last node into its...
Definition: priorityimpl.h:62
#define _Scheduler_Count
This constant contains the count of configured schedulers.
Definition: scheduler.h:395
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
Definition: schedulernodeimpl.h:70
#define STATES_BLOCKED
Definition: statesimpl.h:152
uint32_t States_Control
Definition: states.h:65
Status_Control
Status codes.
Definition: status.h:111
void _Thread_MP_Extract_proxy(Thread_Control *the_thread)
Extracts the proxy of the thread if necessary.
Definition: threadqextractwithproxy.c:46
const Thread_queue_Operations _Thread_queue_Operations_default
The default thread queue operations are used when a thread is not enqueued on a thread queue.
Definition: threadqops.c:1500
Status_Control _Thread_Restart(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
Definition: threadrestart.c:536
void _Thread_Continue(Thread_Control *the_thread, Status_Control status)
Cancels a blocking operation so that the thread can continue its execution.
Definition: threadtimeout.c:45
RTEMS_NO_RETURN void _Thread_Exit(void *exit_value, Thread_Life_state life_states_to_set)
Exits the currently executing thread.
Definition: threadrestart.c:501
void _Thread_Entry_adaptor_idle(Thread_Control *executing)
Calls the start kinds idle entry of the thread.
Definition: threadentryadaptoridle.c:43
Thread_Information _Thread_Information
The internal thread objects information.
void _Thread_Timeout(Watchdog_Control *the_watchdog)
General purpose thread wait timeout.
Definition: threadtimeout.c:101
Thread_Cancel_state _Thread_Cancel(Thread_Control *the_thread, Thread_Control *executing, Thread_Life_state life_states_to_clear)
Cancels the thread.
Definition: threadrestart.c:434
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
Definition: threadget.c:44
Status_Control _Thread_Initialize(Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
Initializes thread.
Definition: threadinitialize.c:368
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
Definition: threadchangepriority.c:396
void _Thread_Handler_initialization(void)
Initializes thread handler.
Definition: thread.c:80
Timestamp_Control _Thread_Get_CPU_time_used_locked(Thread_Control *the_thread)
Gets the used processor time of the thread throughout its entire lifetime if the caller already acqui...
Definition: threadgetcputimeused.c:53
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Definition: threadhandler.c:74
void _Thread_Priority_add(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Adds the specified thread priority node to the corresponding thread priority aggregation.
Definition: threadchangepriority.c:332
size_t _Thread_Get_name(const Thread_Control *the_thread, char *buffer, size_t buffer_size)
Gets the name of the thread.
Definition: threadname.c:65
void _Thread_Priority_perform_actions(Thread_Control *start_of_path, Thread_queue_Context *queue_context)
Checks if the thread is owner of the lock of the join queue.
Definition: threadchangepriority.c:223
#define THREAD_LIFE_TERMINATING
Indicates that thread is terminating.
Definition: thread.h:772
Thread_Cancel_state
Indicates the resulting state of _Thread_Cancel().
Definition: threadimpl.h:409
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
Definition: threadsetstate.c:70
#define THREAD_LIFE_PROTECTED
Indicates that the thread life is protected.
Definition: thread.h:756
RTEMS_NO_RETURN void _Thread_Start_multitasking(void)
Starts thread multitasking.
Definition: threadstartmultitasking.c:46
unsigned int Thread_Life_state
This type represents the thread life state.
Definition: thread.h:747
Timestamp_Control _Thread_Get_CPU_time_used(Thread_Control *the_thread)
Updates the used cpu time for the heir and dispatches a new heir.
Definition: threadgetcputimeused.c:71
Timestamp_Control _Thread_Get_CPU_time_used_after_last_reset(Thread_Control *the_thread)
Gets the used processor time of the thread after the last CPU usage reset.
Definition: threadgetcputimeusedafterreset.c:44
#define THREAD_LIFE_RESTARTING
Indicates that thread is restarting.
Definition: thread.h:764
States_Control _Thread_Clear_state(Thread_Control *the_thread, States_Control state)
Clears the specified thread state.
Definition: threadclearstate.c:72
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:44
void _Thread_Create_idle(void)
Creates idle thread.
Definition: threadcreateidle.c:125
Thread_Control * _Thread_Allocated_fp
Definition: threaddispatch.c:56
void _Thread_Free(Thread_Information *information, Thread_Control *the_thread)
Frees the thread.
Definition: threadinitialize.c:50
Status_Control _Thread_Start(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Starts the specified thread.
Definition: threadstart.c:46
void _Thread_Priority_remove(Thread_Control *the_thread, Priority_Node *priority_node, Thread_queue_Context *queue_context)
Removes the specified thread priority node from the corresponding thread priority aggregation.
Definition: threadchangepriority.c:347
void _Thread_Entry_adaptor_numeric(Thread_Control *executing)
Calls the start kinds numeric entry of the thread.
Definition: threadentryadaptornumeric.c:43
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
Definition: threadrestart.c:168
unsigned int Thread_Wait_flags
This type is able to contain several flags used to control the wait class and state of a thread.
Definition: thread.h:451
void(* Thread_Action_handler)(Thread_Control *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)
This type defines the prototype of thread action handlers.
Definition: thread.h:686
void _Thread_Entry_adaptor_pointer(Thread_Control *executing)
Calls the start kinds pointer entry of the thread.
Definition: threadentryadaptorpointer.c:43
Objects_Id _Thread_Self_id(void)
Gets the identifier of the calling thread.
Definition: threadselfid.c:46
Thread_Zombie_registry _Thread_Zombies
This object is a registry for threads in the STATES_ZOMBIE state.
Definition: threadrestart.c:66
void _Thread_Priority_changed(Thread_Control *the_thread, Priority_Node *priority_node, Priority_Group_order priority_group_order, Thread_queue_Context *queue_context)
Propagates a thread priority value change in the specified thread priority node to the corresponding ...
Definition: threadchangepriority.c:362
void _Thread_Iterate(Thread_Visitor visitor, void *arg)
Calls the visitor with all threads and the given argument until it is done.
Definition: threaditerate.c:43
void _Thread_Initialize_information(Thread_Information *information)
Initializes the thread information.
Definition: thread.c:68
#define THREAD_LIFE_CHANGE_DEFERRED
Indicates that thread life changes are deferred.
Definition: thread.h:781
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
Definition: threadrestart.c:624
Objects_Id _Thread_Wait_get_id(const Thread_Control *the_thread)
Returns the object identifier of the object containing the current thread wait queue.
Definition: threadwaitgetid.c:43
States_Control _Thread_Set_state_locked(Thread_Control *the_thread, States_Control state)
Sets the specified thread state without locking the lock context.
Definition: threadsetstate.c:48
#define THREAD_LIFE_DETACHED
Indicates that thread is detached.
Definition: thread.h:790
Status_Control _Thread_Close(Thread_Control *the_thread, Thread_Control *executing, Thread_queue_Context *queue_context)
Closes the thread.
Definition: threadrestart.c:465
void _Thread_Load_environment(Thread_Control *the_thread)
Initializes enviroment for a thread.
Definition: threadloadenv.c:44
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
Definition: threadname.c:45
void _Thread_Handler(void)
Wrapper function for all threads.
Definition: threadhandler.c:97
Status_Control _Thread_Join(Thread_Control *the_thread, States_Control waiting_for_join, Thread_Control *executing, Thread_queue_Context *queue_context)
Joins the currently executing thread with the thread.
Definition: threadrestart.c:380
States_Control _Thread_Clear_state_locked(Thread_Control *the_thread, States_Control state)
Clears the specified thread state without locking the lock context.
Definition: threadclearstate.c:46
Thread_Life_state _Thread_Change_life(Thread_Life_state life_states_to_clear, Thread_Life_state life_states_to_set, Thread_Life_state ignored_life_states)
Changes the life of currently executing thread.
Definition: threadrestart.c:597
@ THREAD_CANCEL_IN_PROGRESS
Indicates that the thread cancel operation is in progress.
Definition: threadimpl.h:420
@ THREAD_CANCEL_DONE
Indicates that the thread cancel operation is done.
Definition: threadimpl.h:413
int64_t Timestamp_Control
Definition: timestamp.h:76
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdogticks.h:59
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Definition: watchdog.h:85
This header file provides the interfaces of the Internal Error Handler.
This header file provides the main interfaces of the ISR Handler.
This header file provides interfaces of the Scheduler Handler related to scheduler nodes which are on...
This header file provides interfaces of the Object Handler which are only used by the implementation.
This header file provides the interfaces of the Operation Status Support.
This header file provides interfaces of the Thread Handler which are used by the implementation and t...
This header file provides interfaces of the Thread States which are only used by the implementation.
This structure represents a chain node.
Definition: chain.h:78
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:94
Objects_Id id
Definition: objectdata.h:65
Per CPU Core Structure.
Definition: percpu.h:384
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition: percpu.h:473
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
Definition: percpu.h:513
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:437
Timestamp_Control cpu_usage_timestamp
The CPU usage timestamp contains the time point of the last heir thread change or last CPU usage upda...
Definition: percpu.h:489
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition: percpu.h:457
struct Per_CPU_Control::@4403 Watchdog
Watchdog state for this processor.
The priority node to build up a priority aggregation.
Definition: priority.h:112
Priority_Control priority
The priority value of this node.
Definition: priority.h:124
Scheduler node for per-thread data.
Definition: schedulernode.h:94
struct Scheduler_Node::@4406 Wait
Thread wait support block.
Control block to manage thread actions.
Definition: thread.h:733
Thread action.
Definition: thread.h:706
This structure contains operations which manage the CPU budget of a thread.
Definition: thread.h:188
The configuration of a new thread to initialize.
Definition: threadimpl.h:169
Priority_Control priority
The new thread's priority.
Definition: threadimpl.h:195
const struct _Scheduler_Control * scheduler
The scheduler control instance for the thread.
Definition: threadimpl.h:173
void * stack_area
The starting address of the stack area.
Definition: threadimpl.h:178
size_t stack_size
The size of the stack area in bytes.
Definition: threadimpl.h:183
bool is_preemptible
Indicates whether the new thread is preemptible.
Definition: threadimpl.h:220
const Thread_CPU_budget_operations * cpu_budget_operations
The thread's initial CPU budget operations.
Definition: threadimpl.h:200
uint32_t isr_level
The thread's initial ISR level.
Definition: threadimpl.h:210
uint32_t name
32-bit unsigned integer name of the object for the thread.
Definition: threadimpl.h:205
bool is_fp
Indicates whether the thread needs a floating-point area.
Definition: threadimpl.h:215
Thread entry information.
Definition: thread.h:163
Thread_Life_state state
The current thread life state.
Definition: thread.h:805
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:419
The thread zombie registry is used to register threads in the STATES_ZOMBIE state.
Definition: threadimpl.h:73
Chain_Control Chain
This chain contains the registered zombie threads.
Definition: threadimpl.h:84
Thread queue context for the thread queue methods.
Definition: threadq.h:216
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:221
Definition: threadq.h:143
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:148
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:554
Thread_queue_Extract_operation extract
This operation is used to extract the thread from the thread queue.
Definition: threadq.h:580
Definition: threadq.h:427
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Definition: watchdog.h:133
Scheduler control.
Definition: scheduler.h:337
uint32_t name
The scheduler name.
Definition: scheduler.h:359
Context_Control Registers
This member contains the context of this thread.
Definition: thread.h:893
Objects_Control Object
Definition: thread.h:839
Timestamp_Control cpu_time_used
This member contains the amount of CPU time consumed by this thread since it was created.
Definition: thread.h:944
Thread_Wait_information Wait
Definition: thread.h:877
Context_Control_fp * fp_context
Definition: thread.h:964
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:864
States_Control current_state
Definition: thread.h:859
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:874
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:856
Thread_Timer_information Timer
Definition: thread.h:879
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:985
Definition: deflate.c:114
Definition: mmu-config.c:53
This header file provides the interfaces of the System State Handler.
This header file provides the interfaces of the Thread Handler Multiprocessing (MP) Support.
This header file provides interfaces of the Thread Queue Handler which are only used by the implement...
This header file provides interfaces of the Timestamp Handler which are only used by the implementati...
This header file provides the interfaces of the Time of Day Handler and the Time of Day Handler Actio...
This union represents a chain control block.
Definition: chain.h:96
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...