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 )
1162static inline void _Thread_Restore_fp(
Thread_Control *executing )
1164#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1165#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
1167 !_Thread_Is_allocated_fp( executing ) ) {
1188#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1189static inline void _Thread_Deallocate_fp(
void )
1204static inline bool _Thread_Is_context_switch_necessary(
void )
1206 return ( _Thread_Dispatch_necessary );
1214static inline uint32_t _Thread_Get_maximum_internal_threads(
void)
1217 uint32_t maximum_internal_threads =
1221#if defined(RTEMS_MULTIPROCESSING)
1222 if ( _System_state_Is_multiprocessing ) {
1223 ++maximum_internal_threads;
1227 return maximum_internal_threads;
1255static inline Thread_Control *_Thread_Get_heir_and_make_it_executing(
1261 heir = cpu_self->
heir;
1275static inline void _Thread_Update_CPU_time_used(
1296#if defined( RTEMS_SMP )
1297static inline void _Thread_Dispatch_update_heir(
1303 _Thread_Update_CPU_time_used( cpu_for_heir->
heir, cpu_for_heir );
1305 cpu_for_heir->
heir = heir;
1307 _Thread_Dispatch_request( cpu_self, cpu_for_heir );
1354static inline void _Thread_Action_control_initialize(
1358 _Chain_Initialize_empty( &action_control->Chain );
1366static inline void _Thread_Action_initialize(
1370 _Chain_Set_off_chain( &action->Node );
1385static inline void _Thread_Add_post_switch_action(
1393 _Assert( _Thread_State_is_owner( the_thread ) );
1395 cpu_of_thread = _Thread_Get_CPU( the_thread );
1397 action->handler = handler;
1399 _Thread_Dispatch_request( _Per_CPU_Get(), cpu_of_thread );
1401 _Chain_Append_if_is_off_chain_unprotected(
1402 &the_thread->Post_switch_actions.Chain,
1418static inline void _Thread_Append_post_switch_action(
1423 _Assert( _Thread_State_is_owner( the_thread ) );
1424 _Assert( action->handler != NULL );
1426 _Chain_Append_unprotected(
1427 &the_thread->Post_switch_actions.Chain,
1440static inline bool _Thread_Is_life_restarting(
1455static inline bool _Thread_Is_life_terminating(
1470static inline bool _Thread_Is_life_change_allowed(
1486static inline bool _Thread_Is_life_changing(
1502static inline bool _Thread_Is_joinable(
1506 _Assert( _Thread_State_is_owner( the_thread ) );
1515static inline void _Thread_Resource_count_increment(
1519#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1520 ++the_thread->resource_count;
1531static inline void _Thread_Resource_count_decrement(
1535#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1536 --the_thread->resource_count;
1542#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1554static inline bool _Thread_Owns_resources(
1558 return the_thread->resource_count != 0;
1573#if defined(RTEMS_SMP)
1574 return the_thread->
Scheduler.home_scheduler;
1592#if defined(RTEMS_SMP)
1594 return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1595 _Chain_First( &the_thread->
Scheduler.Wait_nodes )
1610static inline Scheduler_Node *_Thread_Scheduler_get_node_by_index(
1612 size_t scheduler_index
1616#if defined(RTEMS_SMP)
1619 + scheduler_index * _Scheduler_Node_size );
1621 (void) scheduler_index;
1626#if defined(RTEMS_SMP)
1633static inline void _Thread_Scheduler_acquire_critical(
1647static inline void _Thread_Scheduler_release_critical(
1660void _Thread_Scheduler_process_requests(
Thread_Control *the_thread );
1669static inline void _Thread_Scheduler_add_request(
1672 Scheduler_Node_request request
1676 Scheduler_Node_request current_request;
1678 _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1680 current_request = scheduler_node->Thread.request;
1682 if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1684 request == SCHEDULER_NODE_REQUEST_ADD
1685 || request == SCHEDULER_NODE_REQUEST_REMOVE
1687 _Assert( scheduler_node->Thread.next_request == NULL );
1688 scheduler_node->Thread.next_request = the_thread->
Scheduler.requests;
1689 the_thread->
Scheduler.requests = scheduler_node;
1690 }
else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1692 ( current_request == SCHEDULER_NODE_REQUEST_ADD
1693 && request == SCHEDULER_NODE_REQUEST_REMOVE )
1694 || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1695 && request == SCHEDULER_NODE_REQUEST_ADD )
1697 request = SCHEDULER_NODE_REQUEST_NOTHING;
1700 scheduler_node->Thread.request = request;
1702 _Thread_Scheduler_release_critical( the_thread, &lock_context );
1712static inline void _Thread_Scheduler_add_wait_node(
1717 _Chain_Append_unprotected(
1719 &scheduler_node->Thread.Wait_node
1721 _Thread_Scheduler_add_request(
1724 SCHEDULER_NODE_REQUEST_ADD
1735static inline void _Thread_Scheduler_remove_wait_node(
1740 _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
1741 _Thread_Scheduler_add_request(
1744 SCHEDULER_NODE_REQUEST_REMOVE
1766 scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
1767 return _Priority_Get_priority( &scheduler_node->
Wait.Priority );
1808static inline void _Thread_Wait_acquire_default_critical(
1830static inline Thread_Control *_Thread_Wait_acquire_default_for_executing(
1837 executing = _Thread_Executing;
1838 _Thread_Wait_acquire_default_critical( executing, lock_context );
1852static inline void _Thread_Wait_acquire_default(
1858 _Thread_Wait_acquire_default_critical( the_thread, lock_context );
1871static inline void _Thread_Wait_release_default_critical(
1890static inline void _Thread_Wait_release_default(
1895 _Thread_Wait_release_default_critical( the_thread, lock_context );
1899#if defined(RTEMS_SMP)
1900#define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
1901 RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
1909static inline void _Thread_Wait_remove_request_locked(
1916 _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
1917 first = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
1919 if ( first != _Chain_Tail( &the_thread->
Wait.Lock.Pending_requests ) ) {
1920 _Thread_queue_Gate_open( (Thread_queue_Gate *) first );
1930static inline void _Thread_Wait_acquire_queue_critical(
1935 _Thread_queue_Queue_acquire_critical(
1937 &_Thread_Executing->Potpourri_stats,
1948static inline void _Thread_Wait_release_queue_critical(
1953 _Thread_queue_Queue_release_critical(
1968static inline void _Thread_Wait_acquire_critical(
1973#if defined(RTEMS_SMP)
1976 _Thread_Wait_acquire_default_critical(
1984 if ( queue != NULL ) {
1985 _Thread_queue_Gate_add(
1986 &the_thread->
Wait.Lock.Pending_requests,
1989 _Thread_Wait_release_default_critical(
1993 _Thread_Wait_acquire_queue_critical( queue, &queue_context->
Lock_context );
1995 if ( queue_context->
Lock_context.Wait.queue == NULL ) {
1996 _Thread_Wait_release_queue_critical(
2000 _Thread_Wait_acquire_default_critical(
2004 _Thread_Wait_remove_request_locked(
2013 (void) queue_context;
2024static inline void _Thread_Wait_acquire(
2030 _Thread_Wait_acquire_critical( the_thread, queue_context );
2043static inline void _Thread_Wait_release_critical(
2048#if defined(RTEMS_SMP)
2053 if ( queue != NULL ) {
2054 _Thread_Wait_release_queue_critical(
2057 _Thread_Wait_acquire_default_critical(
2061 _Thread_Wait_remove_request_locked(
2067 _Thread_Wait_release_default_critical(
2073 (void) queue_context;
2085static inline void _Thread_Wait_release(
2090 _Thread_Wait_release_critical( the_thread, queue_context );
2108static inline void _Thread_Wait_claim(
2115 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2119#if defined(RTEMS_SMP)
2120 _Chain_Initialize_empty( &the_thread->
Wait.Lock.Pending_requests );
2121 _Chain_Initialize_node( &the_thread->
Wait.Lock.Tranquilizer.Node );
2122 _Thread_queue_Gate_close( &the_thread->
Wait.Lock.Tranquilizer );
2127 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2137static inline void _Thread_Wait_claim_finalize(
2156static inline void _Thread_Wait_remove_request(
2161#if defined(RTEMS_SMP)
2164 _Thread_Wait_acquire_default( the_thread, &lock_context );
2165 _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
2166 _Thread_Wait_release_default( the_thread, &lock_context );
2169 (void) queue_lock_context;
2185static inline void _Thread_Wait_restore_default(
2189#if defined(RTEMS_SMP)
2194 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2196 node = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
2197 tail = _Chain_Immutable_tail( &the_thread->
Wait.Lock.Pending_requests );
2199 if ( node != tail ) {
2203 queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2206 node = _Chain_Next( node );
2207 }
while ( node != tail );
2209 _Thread_queue_Gate_add(
2210 &the_thread->
Wait.Lock.Pending_requests,
2211 &the_thread->
Wait.Lock.Tranquilizer
2214 _Thread_queue_Gate_open( &the_thread->
Wait.Lock.Tranquilizer );
2221#if defined(RTEMS_SMP)
2222 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2244static inline void _Thread_Wait_tranquilize(
2248#if defined(RTEMS_SMP)
2249 _Thread_queue_Gate_wait( &the_thread->
Wait.Lock.Tranquilizer );
2262static inline void _Thread_Wait_cancel(
2271 if ( queue != NULL ) {
2272#if defined(RTEMS_SMP)
2281 _Thread_Wait_restore_default( the_thread );
2283#if defined(RTEMS_SMP)
2293#define THREAD_WAIT_STATE_MASK 0xffU
2302#define THREAD_WAIT_STATE_READY 0x0U
2311#define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U
2316#define THREAD_WAIT_STATE_BLOCKED 0x2U
2321#define THREAD_WAIT_CLASS_MASK 0xff00U
2326#define THREAD_WAIT_CLASS_EVENT 0x100U
2331#define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U
2336#define THREAD_WAIT_CLASS_OBJECT 0x400U
2341#define THREAD_WAIT_CLASS_PERIOD 0x800U
2349static inline void _Thread_Wait_flags_set(
2354#if defined(RTEMS_SMP)
2355 _Atomic_Store_uint( &the_thread->
Wait.
flags, flags, ATOMIC_ORDER_RELAXED );
2372#if defined(RTEMS_SMP)
2373 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_RELAXED );
2390#if defined(RTEMS_SMP)
2391 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_ACQUIRE );
2413static inline bool _Thread_Wait_flags_try_change_release(
2421#if defined(RTEMS_SMP)
2422 return _Atomic_Compare_exchange_uint(
2426 ATOMIC_ORDER_RELEASE,
2427 ATOMIC_ORDER_RELAXED
2430 bool success = ( the_thread->
Wait.
flags == expected_flags );
2453static inline bool _Thread_Wait_flags_try_change_acquire(
2459#if defined(RTEMS_SMP)
2460 return _Atomic_Compare_exchange_uint(
2464 ATOMIC_ORDER_ACQUIRE,
2465 ATOMIC_ORDER_ACQUIRE
2473 success = _Thread_Wait_flags_try_change_release(
2541static inline void _Thread_Timer_initialize(
2548 _Watchdog_Preinitialize( &timer->Watchdog, cpu );
2558static inline void _Thread_Add_timeout_ticks(
2568 the_thread->
Timer.header =
2571 _Watchdog_Per_CPU_insert_ticks( &the_thread->
Timer.Watchdog, cpu, ticks );
2584static inline void _Thread_Timer_insert_realtime(
2597 the_thread->
Timer.header = header;
2599 _Watchdog_Per_CPU_insert( &the_thread->
Timer.Watchdog, cpu, header, expire );
2609static inline void _Thread_Timer_remove(
Thread_Control *the_thread )
2615 _Watchdog_Per_CPU_remove(
2616 &the_thread->
Timer.Watchdog,
2617#
if defined(RTEMS_SMP)
2618 the_thread->
Timer.Watchdog.cpu,
2622 the_thread->
Timer.header
2635static inline void _Thread_Remove_timer_and_unblock(
2640 _Thread_Wait_tranquilize( the_thread );
2641 _Thread_Timer_remove( the_thread );
2643#if defined(RTEMS_MULTIPROCESSING)
2644 if ( _Objects_Is_local_id( the_thread->
Object.
id ) ) {
2645 _Thread_Unblock( the_thread );
2647 _Thread_queue_Unblock_proxy( queue, the_thread );
2651 _Thread_Unblock( the_thread );
2684#if defined(RTEMS_SMP)
2685#define THREAD_PIN_STEP 2
2687#define THREAD_PIN_PREEMPTION 1
2695void _Thread_Do_unpin(
2708#if defined(RTEMS_SMP)
2709 _Assert( executing == _Thread_Get_executing() );
2711 executing->
Scheduler.pin_level += THREAD_PIN_STEP;
2723static inline void _Thread_Unpin(
2728#if defined(RTEMS_SMP)
2729 unsigned int pin_level;
2731 _Assert( executing == _Per_CPU_Get_executing( cpu_self ) );
2733 pin_level = executing->
Scheduler.pin_level;
2738 pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2741 executing->
Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2743 _Thread_Do_unpin( executing, cpu_self );
2757#if defined(RTEMS_MULTIPROCESSING)
2775static inline void _Thread_Timer_remove_and_continue(
2780 _Thread_Timer_remove( the_thread );
2781#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:776
#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:1534
Status_Control _Thread_Restart(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
Definition: threadrestart.c:538
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:503
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:626
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:467
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:99
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:599
@ 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
struct Per_CPU_Control::@4363 Watchdog
Watchdog state for this processor.
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
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::@4366 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:217
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:222
Definition: threadq.h:144
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:149
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:563
Thread_queue_Extract_operation extract
This operation is used to extract the thread from the thread queue.
Definition: threadq.h:589
Definition: threadq.h:436
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: 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...