23 #ifndef _RTEMS_SCORE_THREADIMPL_H 24 #define _RTEMS_SCORE_THREADIMPL_H 34 #include <rtems/score/status.h> 40 #include <rtems/config.h> 71 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 75 #if defined(RTEMS_SMP) 76 #define THREAD_OF_SCHEDULER_HELP_NODE( node ) \ 77 RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node ) 80 typedef bool ( *Thread_Visitor )(
Thread_Control *the_thread,
void *arg );
91 Thread_Visitor visitor,
540 executing = _Thread_Executing;
583 #if defined(RTEMS_DEBUG) 588 return _Thread_queue_Is_lock_owner( &the_thread->
Join_queue );
750 #if defined(RTEMS_SMP) 751 void _Thread_Priority_and_sticky_update(
753 int sticky_level_change
845 #if defined(RTEMS_SMP) 850 return _Per_CPU_Get();
865 #if defined(RTEMS_SMP) 888 return ( the_thread == _Thread_Executing );
891 #if defined(RTEMS_SMP) 908 return _CPU_Context_Get_is_executing( &the_thread->
Registers );
927 return ( the_thread == _Thread_Heir );
961 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 990 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 991 #if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE ) 1005 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 1006 #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) 1027 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 1045 return ( _Thread_Dispatch_necessary );
1060 return ( the_thread ==
NULL );
1071 uint32_t maximum_internal_threads =
1075 #if defined(RTEMS_MULTIPROCESSING) 1076 if ( _System_state_Is_multiprocessing ) {
1077 ++maximum_internal_threads;
1081 return maximum_internal_threads;
1115 heir = cpu_self->
heir;
1150 #if defined( RTEMS_SMP ) 1159 cpu_for_heir->
heir = heir;
1216 _Assert( _Thread_State_is_owner( the_thread ) );
1220 action->handler = handler;
1225 &the_thread->Post_switch_actions.Chain,
1242 return ( life_state & THREAD_LIFE_RESTARTING ) != 0;
1257 return ( life_state & THREAD_LIFE_TERMINATING ) != 0;
1273 & ( THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED ) ) == 0;
1289 & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
1304 _Assert( _Thread_State_is_owner( the_thread ) );
1305 return ( the_thread->
Life.
state & THREAD_LIFE_DETACHED ) == 0;
1317 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1318 ++the_thread->resource_count;
1333 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1334 --the_thread->resource_count;
1340 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1356 return the_thread->resource_count != 0;
1360 #if defined(RTEMS_SMP) 1375 _Per_CPU_Acquire( cpu, &lock_context );
1382 _Per_CPU_Release( cpu, &lock_context );
1397 #if defined(RTEMS_SMP) 1398 return the_thread->
Scheduler.home_scheduler;
1416 #if defined(RTEMS_SMP) 1418 return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1436 size_t scheduler_index
1439 #if defined(RTEMS_SMP) 1442 + scheduler_index * _Scheduler_Node_size );
1444 _Assert( scheduler_index == 0 );
1445 (void) scheduler_index;
1450 #if defined(RTEMS_SMP) 1484 void _Thread_Scheduler_process_requests(
Thread_Control *the_thread );
1496 Scheduler_Node_request request
1500 Scheduler_Node_request current_request;
1502 _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1504 current_request = scheduler_node->Thread.request;
1506 if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1508 request == SCHEDULER_NODE_REQUEST_ADD
1509 || request == SCHEDULER_NODE_REQUEST_REMOVE
1511 _Assert( scheduler_node->Thread.next_request ==
NULL );
1512 scheduler_node->Thread.next_request = the_thread->
Scheduler.requests;
1513 the_thread->
Scheduler.requests = scheduler_node;
1514 }
else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1516 ( current_request == SCHEDULER_NODE_REQUEST_ADD
1517 && request == SCHEDULER_NODE_REQUEST_REMOVE )
1518 || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1519 && request == SCHEDULER_NODE_REQUEST_ADD )
1521 request = SCHEDULER_NODE_REQUEST_NOTHING;
1524 scheduler_node->Thread.request = request;
1526 _Thread_Scheduler_release_critical( the_thread, &lock_context );
1543 &scheduler_node->Thread.Wait_node
1545 _Thread_Scheduler_add_request(
1548 SCHEDULER_NODE_REQUEST_ADD
1565 _Thread_Scheduler_add_request(
1568 SCHEDULER_NODE_REQUEST_REMOVE
1658 executing = _Thread_Executing;
1717 #if defined(RTEMS_SMP) 1718 #define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \ 1719 RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node ) 1737 if ( first !=
_Chain_Tail( &the_thread->
Wait.Lock.Pending_requests ) ) {
1738 _Thread_queue_Gate_open( (Thread_queue_Gate *) first );
1753 _Thread_queue_Queue_acquire_critical(
1755 &_Thread_Executing->Potpourri_stats,
1791 #if defined(RTEMS_SMP) 1802 if ( queue !=
NULL ) {
1803 _Thread_queue_Gate_add(
1804 &the_thread->
Wait.Lock.Pending_requests,
1811 _Thread_Wait_acquire_queue_critical( queue, &queue_context->
Lock_context );
1814 _Thread_Wait_release_queue_critical(
1822 _Thread_Wait_remove_request_locked(
1831 (void) queue_context;
1866 #if defined(RTEMS_SMP) 1871 if ( queue !=
NULL ) {
1872 _Thread_Wait_release_queue_critical(
1879 _Thread_Wait_remove_request_locked(
1891 (void) queue_context;
1937 #if defined(RTEMS_SMP) 1940 _Thread_queue_Gate_close( &the_thread->
Wait.Lock.Tranquilizer );
1979 #if defined(RTEMS_SMP) 1983 _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
1987 (void) queue_lock_context;
2007 #if defined(RTEMS_SMP) 2017 if ( node != tail ) {
2021 queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2025 }
while ( node != tail );
2027 _Thread_queue_Gate_add(
2028 &the_thread->
Wait.Lock.Pending_requests,
2029 &the_thread->
Wait.Lock.Tranquilizer
2032 _Thread_queue_Gate_open( &the_thread->
Wait.Lock.Tranquilizer );
2039 #if defined(RTEMS_SMP) 2066 #if defined(RTEMS_SMP) 2067 _Thread_queue_Gate_wait( &the_thread->
Wait.Lock.Tranquilizer );
2089 #if defined(RTEMS_SMP) 2090 if ( queue !=
NULL ) {
2101 #if defined(RTEMS_SMP) 2111 #define THREAD_WAIT_FLAGS_INITIAL 0x0U 2116 #define THREAD_WAIT_STATE_MASK 0xffU 2125 #define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U 2130 #define THREAD_WAIT_STATE_BLOCKED 0x2U 2137 #define THREAD_WAIT_STATE_READY_AGAIN 0x4U 2142 #define THREAD_WAIT_CLASS_MASK 0xff00U 2147 #define THREAD_WAIT_CLASS_EVENT 0x100U 2152 #define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U 2157 #define THREAD_WAIT_CLASS_OBJECT 0x400U 2162 #define THREAD_WAIT_CLASS_PERIOD 0x800U 2175 #if defined(RTEMS_SMP) 2176 _Atomic_Store_uint( &the_thread->
Wait.
flags, flags, ATOMIC_ORDER_RELAXED );
2193 #if defined(RTEMS_SMP) 2194 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_RELAXED );
2211 #if defined(RTEMS_SMP) 2212 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_ACQUIRE );
2242 #if defined(RTEMS_SMP) 2243 return _Atomic_Compare_exchange_uint(
2247 ATOMIC_ORDER_RELEASE,
2248 ATOMIC_ORDER_RELAXED
2251 bool success = ( the_thread->
Wait.
flags == expected_flags );
2280 #if defined(RTEMS_SMP) 2281 return _Atomic_Compare_exchange_uint(
2285 ATOMIC_ORDER_ACQUIRE,
2286 ATOMIC_ORDER_ACQUIRE
2389 the_thread->
Timer.header =
2418 the_thread->
Timer.header = header;
2437 &the_thread->
Timer.Watchdog,
2438 #
if defined(RTEMS_SMP)
2439 the_thread->
Timer.Watchdog.cpu,
2443 the_thread->
Timer.header
2464 #if defined(RTEMS_MULTIPROCESSING) 2468 _Thread_queue_Unblock_proxy( queue, the_thread );
2505 #if defined(RTEMS_SMP) 2506 #define THREAD_PIN_STEP 2 2508 #define THREAD_PIN_PREEMPTION 1 2516 void _Thread_Do_unpin(
2529 #if defined(RTEMS_SMP) 2530 _Assert( executing == _Thread_Executing );
2532 executing->
Scheduler.pin_level += THREAD_PIN_STEP;
2549 #if defined(RTEMS_SMP) 2550 unsigned int pin_level;
2552 _Assert( executing == _Thread_Executing );
2554 pin_level = executing->
Scheduler.pin_level;
2559 pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2562 executing->
Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2564 _Thread_Do_unpin( executing, cpu_self );
2578 #if defined(RTEMS_MULTIPROCESSING) void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Definition: threadyield.c:30
RTEMS_INLINE_ROUTINE void _Watchdog_Per_CPU_remove(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header)
Removes the watchdog from the cpu and the scheduled watchdogs.
Definition: watchdogimpl.h:649
Constants and Prototypes Related to the Internal Error Handler.
void _Thread_Load_environment(Thread_Control *the_thread)
Initializes enviroment for a thread.
Definition: threadloadenv.c:24
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Header *header, uint64_t expire)
Sets the watchdog's cpu and inserts it with the given expiration time in the scheduled watchdogs.
Definition: watchdogimpl.h:625
RTEMS_INLINE_ROUTINE void _Thread_Remove_timer_and_unblock(Thread_Control *the_thread, Thread_queue_Queue *queue)
Remove the watchdog timer from the thread and unblock if necessary.
Definition: threadimpl.h:2456
RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1632
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Definition: watchdog.h:66
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_request(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target)
Requests a thread dispatch on the target processor.
Definition: threaddispatch.h:235
RTEMS_INLINE_ROUTINE void _Thread_Wait_release_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1861
Index for realtime clock per-CPU watchdog header.
Definition: percpu.h:325
void _Thread_Get_CPU_time_used(Thread_Control *the_thread, Timestamp_Control *cpu_time_used)
Updates the used cpu time for the heir and dispatches a new heir.
Definition: threadgetcputimeused.c:31
RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default(Thread_Control *the_thread)
Restores the default thread wait queue and operations.
Definition: threadimpl.h:2003
RTEMS_INLINE_ROUTINE void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
Definition: chainimpl.h:558
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_restarting(Thread_Life_state life_state)
Checks if the thread life state is restarting.
Definition: threadimpl.h:1238
Timestamp_Control cpu_time_used
Definition: thread.h:827
Thread_CPU_budget_algorithms budget_algorithm
The thread's budget algorithm.
Definition: threadimpl.h:159
RTEMS_INLINE_ROUTINE Objects_Control * _Objects_Allocate_unprotected(Objects_Information *information)
Allocates an object without locking the allocator mutex.
Definition: objectimpl.h:874
Thread_Life_state state
The current thread life state.
Definition: thread.h:700
#define _Context_Save_fp(_fp)
Save floating point context area.
Definition: context.h:153
Definition: deflate.c:115
int64_t Timestamp_Control
Definition: timestamp.h:57
RTEMS_INLINE_ROUTINE void _Chain_Initialize_node(Chain_Node *the_node)
Initializes a chain node.
Definition: chainimpl.h:122
RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_release(Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
Tries to change the thread wait flags with release semantics in case of success.
Definition: threadimpl.h:2234
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Returns pointer to chain tail.
Definition: chainimpl.h:227
RTEMS_INLINE_ROUTINE Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
Definition: threadimpl.h:2328
Definition: threadq.h:125
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_Next(const Chain_Node *the_node)
Returns pointer to the next node from this node.
Definition: chainimpl.h:327
#define _Context_Restore_fp(_fp)
Restore floating point context area.
Definition: context.h:142
void _Thread_Close(Thread_Control *the_thread, Thread_Control *executing, Thread_Close_context *context)
Closes the thread.
Definition: threadrestart.c:509
RTEMS_INLINE_ROUTINE bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
Definition: objectimpl.h:584
RTEMS_INLINE_ROUTINE void _Thread_queue_Queue_release_critical(Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
Releases the thread queue queue in a critical section.
Definition: threadqimpl.h:603
void * allocated_stack
The address of the allocated stack area or NULL.
Definition: threadimpl.h:149
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:70
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdogticks.h:38
Thread_Life_state
Thread life states.
Definition: thread.h:679
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:263
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
Definition: percpu.h:474
RTEMS_INLINE_ROUTINE void _Thread_Set_CPU(Thread_Control *thread, Per_CPU_Control *cpu)
Sets the cpu of the thread's scheduler.
Definition: threadimpl.h:860
RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock and disables interrupts.
Definition: threadimpl.h:1673
Thread_Wait_information Wait
Definition: thread.h:774
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
Definition: isrlevel.h:57
Thread queue context for the thread queue methods.
Definition: threadq.h:198
The priority node to build up a priority aggregation.
Definition: priority.h:98
RTEMS_INLINE_ROUTINE bool _Thread_Priority_less_than(Priority_Control left, Priority_Control right)
Updates the priority of the thread and changes it sticky level.
Definition: threadimpl.h:767
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition: percpu.h:420
Thread entry information.
Definition: thread.h:136
RTEMS_INLINE_ROUTINE void _Thread_Wait_remove_request(Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
Removes a thread wait lock request.
Definition: threadimpl.h:1974
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread's resource count.
Definition: threadimpl.h:1329
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
Definition: threadrestart.c:216
Data Related to the Management of Processor Interrupt Levels.
Inlined Routines in the Watchdog Handler.
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
Thread_Life_state _Thread_Change_life(Thread_Life_state clear, Thread_Life_state set, Thread_Life_state ignore)
Changes the currently executing thread to a new state with the sets.
Definition: threadrestart.c:649
RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp(const Thread_Control *the_thread)
Checks if the floating point context of the thread is currently loaded in the floating point unit.
Definition: threadimpl.h:962
void _Thread_Exit(Thread_Control *executing, Thread_Life_state set, void *exit_value)
Exits the currently executing thread.
Definition: threadrestart.c:532
RTEMS_INLINE_ROUTINE void _Chain_Set_off_chain(Chain_Node *node)
Sets off chain.
Definition: chainimpl.h:104
The control block used to manage each watchdog timer.
Definition: watchdog.h:90
#define STATES_BLOCKED
Definition: statesimpl.h:135
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_Wait_acquire_default_for_executing(ISR_lock_Context *lock_context)
Acquires the thread wait default lock and returns the executing thread.
Definition: threadimpl.h:1651
RTEMS_INLINE_ROUTINE void _Thread_Unblock(Thread_Control *the_thread)
Unblocks the thread.
Definition: threadimpl.h:939
void _Thread_Entry_adaptor_pointer(Thread_Control *executing)
Calls the start kinds pointer entry of the thread.
Definition: threadentryadaptorpointer.c:21
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_Internal_allocate(void)
Allocates an internal thread and returns it.
Definition: threadimpl.h:1090
RTEMS_INLINE_ROUTINE void _Thread_Pin(Thread_Control *executing)
Pin the executing thread.
Definition: threadimpl.h:2527
RTEMS_INLINE_ROUTINE void _Chain_Initialize_empty(Chain_Control *the_chain)
Initializes this chain as empty.
Definition: chainimpl.h:505
#define RTEMS_NO_RETURN
Definition: basedefs.h:102
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_terminating(Thread_Life_state life_state)
Checks if the thread life state is terminating.
Definition: threadimpl.h:1253
RTEMS_INLINE_ROUTINE void _Thread_Action_initialize(Thread_Action *action)
Initializes the Thread action.
Definition: threadimpl.h:1194
Priority_Control priority
The priority value of this node.
Definition: priority.h:110
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:419
Scheduler Node Implementation.
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:25
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:771
RTEMS_INLINE_ROUTINE void _Thread_Wait_tranquilize(Thread_Control *the_thread)
Tranquilizes the thread after a wait on a thread queue.
Definition: threadimpl.h:2062
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_change_allowed(Thread_Life_state life_state)
Checks if the thread life state allos life change.
Definition: threadimpl.h:1268
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_State_acquire_for_executing(ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock context for the currently executing thread.
Definition: threadimpl.h:533
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_priority(const Thread_Control *the_thread)
Returns the unmapped priority of the thread.
Definition: threadimpl.h:1601
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
Definition: threadget.c:24
RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire_critical(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1786
RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get_acquire(const Thread_Control *the_thread)
Gets the thread's wait flags according to the ATOMIC_ORDER_ACQUIRE.
Definition: threadimpl.h:2207
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_node_by_index(const Thread_Control *the_thread, size_t scheduler_index)
Gets the thread's scheduler node by index.
Definition: threadimpl.h:1434
Context_Control_fp * fp_context
Definition: thread.h:842
bool _Thread_Initialize(Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
Initializes thread.
Definition: threadinitialize.c:29
RTEMS_INLINE_ROUTINE void _Thread_Wait_acquire(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait default lock and disables interrupts.
Definition: threadimpl.h:1842
RTEMS_INLINE_ROUTINE void _Thread_Update_CPU_time_used(Thread_Control *the_thread, Per_CPU_Control *cpu)
Updates the cpu time used of the thread.
Definition: threadimpl.h:1129
Helpers for Manipulating Timestamps.
RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads(void)
Gets the maximum number of internal threads.
Definition: threadimpl.h:1068
#define _ISR_Get_level()
Return current interrupt level.
Definition: isrlevel.h:128
Definition: threadq.h:402
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:452
RTEMS_INLINE_ROUTINE void _Thread_Save_fp(Thread_Control *executing)
Saves the executing thread's floating point area.
Definition: threadimpl.h:988
RTEMS_INLINE_ROUTINE void _Timestamp_Add_to(Timestamp_Control *_time, const Timestamp_Control *_add)
Adds two timestamps.
Definition: timestampimpl.h:147
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Definition: watchdog.h:114
Objects_Name name
Name of the object for the thread.
Definition: threadimpl.h:169
RTEMS_INLINE_ROUTINE Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
Definition: object.h:255
uint32_t States_Control
Definition: states.h:46
Thread queue operations.
Definition: threadq.h:517
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Priority_highest(Priority_Control left, Priority_Control right)
Returns the highest priority of the left and right thread priorities in the intuitive sense of priori...
Definition: threadimpl.h:784
Information for the Assert Handler.
void _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 given thread to wait for.
Definition: threadrestart.c:421
RTEMS_INLINE_ROUTINE void _Thread_Wait_flags_set(Thread_Control *the_thread, Thread_Wait_flags flags)
Sets the thread's wait flags.
Definition: threadimpl.h:2170
RTEMS_INLINE_ROUTINE bool _Chain_Is_empty(const Chain_Control *the_chain)
Checks if the chain is empty.
Definition: chainimpl.h:393
RTEMS_INLINE_ROUTINE void _Thread_Timer_insert_realtime(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Service_routine_entry routine, uint64_t expire)
Inserts the cpu's watchdog realtime into the thread's timer.
Definition: threadimpl.h:2405
RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp(void)
Deallocates the currently loaded floating point context.
Definition: threadimpl.h:1028
void _Thread_Priority_changed(Thread_Control *the_thread, Priority_Node *priority_node, bool prepend_it, Thread_queue_Context *queue_context)
Propagates a thread priority value change in the specified thread priority node to the corresponding ...
Definition: threadchangepriority.c:307
RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock and restores the previous interrupt status.
Definition: threadimpl.h:1708
RTEMS_INLINE_ROUTINE void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread's resource count.
Definition: threadimpl.h:1313
void _Thread_Timeout(Watchdog_Control *the_watchdog)
General purpose thread wait timeout.
Definition: threadtimeout.c:83
RTEMS_INLINE_ROUTINE Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain's first node.
Definition: chainimpl.h:260
RTEMS_INLINE_ROUTINE void _Watchdog_Preinitialize(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu)
Pre-initializes a watchdog.
Definition: watchdogimpl.h:214
RTEMS_INLINE_ROUTINE void _Priority_Node_set_priority(Priority_Node *node, Priority_Control priority)
Sets the priority of the priority node to the given priority.
Definition: priorityimpl.h:171
RTEMS_INLINE_ROUTINE bool _Thread_Is_null(const Thread_Control *the_thread)
Checks if the thread is NULL.
Definition: threadimpl.h:1056
Priority_Control priority
The new thread's priority.
Definition: threadimpl.h:154
#define RTEMS_PREDICT_TRUE(_exp)
Returns the value of the specified integral expression and tells the compiler that the predicted valu...
Definition: basedefs.h:374
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:390
Control block to manage thread actions.
Definition: thread.h:665
const struct _Scheduler_Control * scheduler
The scheduler control instance for the thread.
Definition: threadimpl.h:134
Per CPU Core Structure.
Definition: percpu.h:347
RTEMS_INLINE_ROUTINE void _Thread_Wait_release(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock and restores the previous interrupt status.
Definition: threadimpl.h:1903
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Definition: threadhandler.c:49
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
Definition: threadrestart.c:671
uint32_t ISR_Level
Definition: isrlevel.h:41
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:28
The configuration of a new thread to initialize.
Definition: threadimpl.h:130
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
Definition: threadname.c:17
RTEMS_INLINE_ROUTINE void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
Definition: threadimpl.h:566
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_unmapped_real_priority(const Thread_Control *the_thread)
Returns the unmapped real priority of the thread.
Definition: threadimpl.h:1615
void _Thread_Start_multitasking(void) RTEMS_NO_RETURN
Starts thread multitasking.
Definition: threadstartmultitasking.c:24
void _Thread_Create_idle(void)
Creates idle thread.
Definition: threadcreateidle.c:93
Thread action.
Definition: thread.h:640
RTEMS_INLINE_ROUTINE void _Thread_Wait_claim_finalize(Thread_Control *the_thread, const Thread_queue_Operations *operations)
Finalizes the thread wait queue claim via registration of the corresponding thread queue operations.
Definition: threadimpl.h:1955
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:203
Objects_Control Object
Definition: thread.h:734
size_t stack_size
The size of the stack area in bytes.
Definition: threadimpl.h:144
RTEMS_INLINE_ROUTINE const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Returns pointer to immutable chain tail.
Definition: chainimpl.h:243
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:21
Thread_queue_Extract_operation extract
Thread queue extract operation.
Definition: threadq.h:535
Thread_CPU_budget_algorithm_callout budget_callout
The thread's initial budget callout.
Definition: threadimpl.h:164
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
Definition: isrlevel.h:74
Constants and Structures Associated with the Manipulation of Objects.
RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary(void)
Checks if dispatching is disabled.
Definition: threadimpl.h:1043
States_Control _Thread_Clear_state(Thread_Control *the_thread, States_Control state)
Clears the specified thread state.
Definition: threadclearstate.c:51
RTEMS_INLINE_ROUTINE void _Thread_Unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
Definition: threadimpl.h:2544
States_Control current_state
Definition: thread.h:756
void _Thread_Priority_replace(Thread_Control *the_thread, Priority_Node *victim_node, Priority_Node *replacement_node)
Replaces the victim priority node with the replacement priority node in the corresponding thread prio...
Definition: threadchangepriority.c:323
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
Definition: schedulernodeimpl.h:61
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:293
RTEMS_INLINE_ROUTINE void _Thread_queue_Do_release_critical(Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
Checks if the thread queue control is the owner of the lock.
Definition: threadqimpl.h:747
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing(Thread_Life_state life_state)
Checks if the thread life state is life changing.
Definition: threadimpl.h:1284
RTEMS_INLINE_ROUTINE void _Thread_Add_timeout_ticks(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Adds timeout ticks to the thread.
Definition: threadimpl.h:2379
const Scheduler_Control _Scheduler_Table[]
Registered schedulers.
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:316
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
Definition: threadchangepriority.c:339
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
Definition: threadsetstate.c:50
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:21
Thread_CPU_budget_algorithms
Definition: thread.h:164
RTEMS_INLINE_ROUTINE void _Thread_queue_Do_acquire_critical(Thread_queue_Control *the_thread_queue, ISR_lock_Context *lock_context)
Acquires the thread queue control in a critical section.
Definition: threadqimpl.h:665
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:182
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_Get_CPU(const Thread_Control *thread)
Gets the cpu of the thread's scheduler.
Definition: threadimpl.h:841
RTEMS_INLINE_ROUTINE bool _Objects_Is_api_valid(uint32_t the_api)
Checks if the api is valid.
Definition: objectimpl.h:549
Inlined Routines Associated with Thread State Information.
RTEMS_INLINE_ROUTINE void _Thread_Wait_release_default_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the thread wait default lock inside a critical section (interrupts disabled).
Definition: threadimpl.h:1692
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:400
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
Definition: isrlock.h:238
RTEMS_INLINE_ROUTINE Objects_Information * _Thread_Get_objects_information(Objects_Id id)
Gets object information for the object id.
Definition: threadimpl.h:800
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition: percpu.h:436
RTEMS_INLINE_ROUTINE void _Timestamp_Subtract(const Timestamp_Control *_start, const Timestamp_Control *_end, Timestamp_Control *_result)
Subtracts two timestamps.
Definition: timestampimpl.h:166
void _Thread_Entry_adaptor_idle(Thread_Control *executing)
Calls the start kinds idle entry of the thread.
Definition: threadentryadaptoridle.c:21
RTEMS_INLINE_ROUTINE void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node (unprotected).
Definition: chainimpl.h:680
RTEMS_INLINE_ROUTINE void _Thread_Restore_fp(Thread_Control *executing)
Restores the executing thread's floating point area.
Definition: threadimpl.h:1003
void _Thread_Restart_self(Thread_Control *executing, const Thread_Entry_information *entry, ISR_lock_Context *lock_context) RTEMS_NO_RETURN
Restarts the currently executing thread.
Definition: threadrestart.c:602
void _Thread_Entry_adaptor_numeric(Thread_Control *executing)
Calls the start kinds numeric entry of the thread.
Definition: threadentryadaptornumeric.c:21
RTEMS_INLINE_ROUTINE bool _Thread_Is_executing(const Thread_Control *the_thread)
Checks if the thread is the currently executing thread.
Definition: threadimpl.h:884
RTEMS_INLINE_ROUTINE const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Definition: threadimpl.h:1393
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:25
bool is_fp
Indicates whether the thread needs a floating-point area.
Definition: threadimpl.h:179
unsigned context
Definition: tlb.h:108
System State Handler API.
void * stack_area
The starting address of the stack area.
Definition: threadimpl.h:139
RTEMS_INLINE_ROUTINE void _Thread_State_acquire_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the lock context in a critical section.
Definition: threadimpl.h:502
void _Thread_Handler(void)
Wrapper function for all threads.
Definition: threadhandler.c:72
RTEMS_INLINE_ROUTINE bool _Thread_Is_joinable(const Thread_Control *the_thread)
Checks if the thread is joinable.
Definition: threadimpl.h:1300
void(* Thread_CPU_budget_algorithm_callout)(Thread_Control *)
Definition: thread.h:178
Thread_Control * _Thread_Allocated_fp
Definition: threaddispatch.c:35
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:753
Scheduler control.
Definition: scheduler.h:269
Scheduler node for per-thread data.
Definition: schedulernode.h:79
RTEMS_INLINE_ROUTINE bool _Thread_Is_heir(const Thread_Control *the_thread)
Checks if the thread is the heir.
Definition: threadimpl.h:923
RTEMS_INLINE_ROUTINE void _Thread_Wait_claim(Thread_Control *the_thread, Thread_queue_Queue *queue)
Claims the thread wait queue.
Definition: threadimpl.h:1926
RTEMS_INLINE_ROUTINE bool _Thread_Is_ready(const Thread_Control *the_thread)
Checks if the thread is ready.
Definition: threadimpl.h:375
bool _Thread_Start(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Initializes thread and executes it.
Definition: threadstart.c:26
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:398
RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get(const Thread_Control *the_thread)
Gets the thread's wait flags according to the ATOMIC_ORDER_RELAXED.
Definition: threadimpl.h:2189
Definition: threadimpl.h:345
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:185
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:292
RTEMS_INLINE_ROUTINE bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Definition: statesimpl.h:195
bool is_preemptible
Indicates whether the new thread is preemptible.
Definition: threadimpl.h:184
struct Scheduler_Node::@3980 Wait
Thread wait support block.
uint32_t Objects_Id
Definition: object.h:80
void _Thread_Handler_initialization(void)
Initializes thread handler.
Definition: thread.c:59
RTEMS_INLINE_ROUTINE void _Chain_Append_if_is_off_chain_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node on the end of a chain if the node is in the off chain state (unprotected).
Definition: chainimpl.h:711
RTEMS_INLINE_ROUTINE Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
Definition: priorityimpl.h:270
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:358
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
Definition: threadimpl.h:1584
RTEMS_INLINE_ROUTINE void _Thread_Wait_cancel(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Cancels a thread wait on a thread queue.
Definition: threadimpl.h:2080
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
RTEMS_INLINE_ROUTINE void _Thread_Timer_initialize(Thread_Timer_information *timer, Per_CPU_Control *cpu)
Initializes the thread timer.
Definition: threadimpl.h:2362
RTEMS_INLINE_ROUTINE Thread_Control * _Thread_Get_heir_and_make_it_executing(Per_CPU_Control *cpu_self)
Gets the heir of the processor and makes it executing.
Definition: threadimpl.h:1109
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:130
RTEMS_INLINE_ROUTINE void _Thread_Action_control_initialize(Thread_Action_control *action_control)
Initializes the control chain of the action control.
Definition: threadimpl.h:1182
RTEMS_INLINE_ROUTINE bool _Chain_Is_node_off_chain(const Chain_Node *node)
Checks if the node is off chain.
Definition: chainimpl.h:142
Index for tick clock per-CPU watchdog header.
Definition: percpu.h:316
Definition: mmu-config.c:40
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:277
Inlined Routines in the Object Handler.
RTEMS_INLINE_ROUTINE void _Thread_Priority_change(Thread_Control *the_thread, Priority_Node *priority_node, Priority_Control new_priority, bool prepend_it, Thread_queue_Context *queue_context)
Changes the thread priority value of the specified thread priority node in the corresponding thread p...
Definition: threadimpl.h:696
Multiprocessing Portion of the Thread Package.
void _Thread_Cancel(Thread_Control *the_thread, Thread_Control *executing, void *exit_value)
Cancels the thread.
Definition: threadrestart.c:450
uint32_t isr_level
The thread's initial ISR level.
Definition: threadimpl.h:174
Context_Control Registers
Definition: thread.h:837
Thread_Information _Thread_Information
The internal thread objects information.
RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action(Thread_Control *the_thread, Thread_Action *action, Thread_Action_handler handler)
Adds a post switch action to the thread with the given handler.
Definition: threadimpl.h:1208
RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_acquire(Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
Tries to change the thread wait flags with acquire semantics.
Definition: threadimpl.h:2274
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:859
RTEMS_INLINE_ROUTINE void _Thread_State_release_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Release the lock context in a critical section.
Definition: threadimpl.h:552
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:761
#define RTEMS_INLINE_ROUTINE
Definition: basedefs.h:66
Constants and Structures Related with the Thread Control Block.
void(* Thread_Action_handler)(Thread_Control *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)
Thread action handler.
Definition: thread.h:620
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:37
#define rtems_configuration_get_maximum_processors()
Returns the configured maximum count of processors.
Definition: config.h:164
RTEMS_INLINE_ROUTINE void _Thread_Timer_remove(Thread_Control *the_thread)
Remove the watchdog timer from the thread.
Definition: threadimpl.h:2430
RTEMS_INLINE_ROUTINE uint64_t _Watchdog_Per_CPU_insert_ticks(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Sets the watchdog's cpu to the given instance and sets its expiration time to the watchdog expiration...
Definition: watchdogimpl.h:593
struct Per_CPU_Control::@3977 Watchdog
Watchdog state for this processor.
void _Thread_Initialize_information(Thread_Information *information)
Initializes the thread information.
Definition: thread.c:47
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
Definition: assert.h:100
RTEMS_INLINE_ROUTINE Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
Definition: threadimpl.h:1412
Thread_Timer_information Timer
Definition: thread.h:776
#define NULL
Requests a GPIO pin group configuration.
Definition: bestcomm_api.h:77
bool _Thread_Restart_other(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
Definition: threadrestart.c:559
RTEMS_INLINE_ROUTINE void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
Definition: threadimpl.h:516
Objects_Id id
Definition: objectdata.h:43