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,
151 void ( *stack_free )(
void * );
566 executing = _Thread_Executing;
609 #if defined(RTEMS_DEBUG) 614 return _Thread_queue_Is_lock_owner( &the_thread->
Join_queue );
776 #if defined(RTEMS_SMP) 779 int sticky_level_change
871 #if defined(RTEMS_SMP) 876 return _Per_CPU_Get();
891 #if defined(RTEMS_SMP) 914 return ( the_thread == _Thread_Executing );
917 #if defined(RTEMS_SMP) 934 return _CPU_Context_Get_is_executing( &the_thread->
Registers );
953 return ( the_thread == _Thread_Heir );
987 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 992 return ( the_thread == _Thread_Allocated_fp );
1016 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 1017 #if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE ) 1018 if ( executing->fp_context != NULL )
1031 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 1032 #if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE ) 1033 if ( (executing->fp_context != NULL) &&
1034 !_Thread_Is_allocated_fp( executing ) ) {
1035 if ( _Thread_Allocated_fp != NULL )
1038 _Thread_Allocated_fp = executing;
1041 if ( executing->fp_context != NULL )
1053 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE ) 1056 _Thread_Allocated_fp = NULL;
1071 return ( _Thread_Dispatch_necessary );
1086 return ( the_thread == NULL );
1097 uint32_t maximum_internal_threads =
1101 #if defined(RTEMS_MULTIPROCESSING) 1102 if ( _System_state_Is_multiprocessing ) {
1103 ++maximum_internal_threads;
1107 return maximum_internal_threads;
1141 heir = cpu_self->
heir;
1176 #if defined( RTEMS_SMP ) 1185 cpu_for_heir->
heir = heir;
1242 _Assert( _Thread_State_is_owner( the_thread ) );
1246 action->handler = handler;
1251 &the_thread->Post_switch_actions.Chain,
1268 return ( life_state & THREAD_LIFE_RESTARTING ) != 0;
1283 return ( life_state & THREAD_LIFE_TERMINATING ) != 0;
1299 & ( THREAD_LIFE_PROTECTED | THREAD_LIFE_CHANGE_DEFERRED ) ) == 0;
1315 & ( THREAD_LIFE_RESTARTING | THREAD_LIFE_TERMINATING ) ) != 0;
1330 _Assert( _Thread_State_is_owner( the_thread ) );
1331 return ( the_thread->
Life.
state & THREAD_LIFE_DETACHED ) == 0;
1343 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1344 ++the_thread->resource_count;
1359 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1360 --the_thread->resource_count;
1366 #if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT) 1382 return the_thread->resource_count != 0;
1386 #if defined(RTEMS_SMP) 1401 _Per_CPU_Acquire( cpu, &lock_context );
1408 _Per_CPU_Release( cpu, &lock_context );
1423 #if defined(RTEMS_SMP) 1442 #if defined(RTEMS_SMP) 1444 return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1462 size_t scheduler_index
1465 #if defined(RTEMS_SMP) 1470 _Assert( scheduler_index == 0 );
1471 (void) scheduler_index;
1476 #if defined(RTEMS_SMP) 1684 executing = _Thread_Executing;
1743 #if defined(RTEMS_SMP) 1744 #define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \ 1745 RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node ) 1779 _Thread_queue_Queue_acquire_critical(
1781 &_Thread_Executing->Potpourri_stats,
1817 #if defined(RTEMS_SMP) 1828 if ( queue != NULL ) {
1857 (void) queue_context;
1892 #if defined(RTEMS_SMP) 1897 if ( queue != NULL ) {
1917 (void) queue_context;
1963 #if defined(RTEMS_SMP) 2005 #if defined(RTEMS_SMP) 2013 (void) queue_lock_context;
2033 #if defined(RTEMS_SMP) 2043 if ( node != tail ) {
2047 queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2051 }
while ( node != tail );
2065 #if defined(RTEMS_SMP) 2092 #if defined(RTEMS_SMP) 2115 #if defined(RTEMS_SMP) 2116 if ( queue != NULL ) {
2127 #if defined(RTEMS_SMP) 2137 #define THREAD_WAIT_FLAGS_INITIAL 0x0U 2142 #define THREAD_WAIT_STATE_MASK 0xffU 2151 #define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U 2156 #define THREAD_WAIT_STATE_BLOCKED 0x2U 2163 #define THREAD_WAIT_STATE_READY_AGAIN 0x4U 2168 #define THREAD_WAIT_CLASS_MASK 0xff00U 2173 #define THREAD_WAIT_CLASS_EVENT 0x100U 2178 #define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U 2183 #define THREAD_WAIT_CLASS_OBJECT 0x400U 2188 #define THREAD_WAIT_CLASS_PERIOD 0x800U 2201 #if defined(RTEMS_SMP) 2202 _Atomic_Store_uint( &the_thread->
Wait.
flags, flags, ATOMIC_ORDER_RELAXED );
2219 #if defined(RTEMS_SMP) 2220 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_RELAXED );
2237 #if defined(RTEMS_SMP) 2238 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_ACQUIRE );
2268 #if defined(RTEMS_SMP) 2269 return _Atomic_Compare_exchange_uint(
2273 ATOMIC_ORDER_RELEASE,
2274 ATOMIC_ORDER_RELAXED
2277 bool success = ( the_thread->
Wait.
flags == expected_flags );
2306 #if defined(RTEMS_SMP) 2307 return _Atomic_Compare_exchange_uint(
2311 ATOMIC_ORDER_ACQUIRE,
2312 ATOMIC_ORDER_ACQUIRE
2415 the_thread->
Timer.header =
2444 the_thread->
Timer.header = header;
2463 &the_thread->
Timer.Watchdog,
2464 #
if defined(RTEMS_SMP)
2469 the_thread->
Timer.header
2490 #if defined(RTEMS_MULTIPROCESSING) 2494 _Thread_queue_Unblock_proxy( queue, the_thread );
2531 #if defined(RTEMS_SMP) 2532 #define THREAD_PIN_STEP 2 2534 #define THREAD_PIN_PREEMPTION 1 2555 #if defined(RTEMS_SMP) 2556 _Assert( executing == _Thread_Executing );
2575 #if defined(RTEMS_SMP) 2576 unsigned int pin_level;
2578 _Assert( executing == _Thread_Executing );
2585 pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2604 #if defined(RTEMS_MULTIPROCESSING) 2605 #include <rtems/score/threadmp.h>
static __inline__ Objects_Information * _Thread_Get_objects_information(Objects_Id id)
Gets object information for the object id.
static __inline__ void _Thread_Unblock(Thread_Control *the_thread)
Unblocks the thread.
void _Thread_Yield(Thread_Control *executing)
Yields the currently executing thread.
Constants and Prototypes Related to the Internal Error Handler.
void _Thread_Load_environment(Thread_Control *the_thread)
Initializes enviroment for a thread.
const struct _Scheduler_Control * home_scheduler
The home scheduler of this thread.
Watchdog_Service_routine(* Watchdog_Service_routine_entry)(Watchdog_Control *)
Pointer to a watchdog service routine.
Index for realtime clock per-CPU watchdog header.
void _Thread_Get_CPU_time_used(Thread_Control *the_thread, Timestamp_Control *cpu_time_used)
Gets the used cpu time of the thread and stores it in the given Timestamp_Control.
Timestamp_Control cpu_time_used
static __inline__ Chain_Node * _Chain_First(const Chain_Control *the_chain)
Returns pointer to chain's first node.
Thread_CPU_budget_algorithms budget_algorithm
The thread's budget algorithm.
Thread_Life_state state
The current thread life state.
static __inline__ bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
#define _Context_Save_fp(_fp)
Save floating point context area.
static void _TOD_Get_uptime(Timestamp_Control *time)
Gets the system uptime with potential accuracy to the nanosecond.
static __inline__ void _Thread_Action_control_initialize(Thread_Action_control *action_control)
Initializes the control chain of the action control.
int64_t Timestamp_Control
void _Thread_Scheduler_process_requests(Thread_Control *the_thread)
Process the thread's scheduler requests.
static __inline__ void _Thread_Add_timeout_ticks(Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks)
Adds timeout ticks to the thread.
static __inline__ 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.
#define _Context_Restore_fp(_fp)
Restore floating point context area.
void _Thread_Close(Thread_Control *the_thread, Thread_Control *executing, Thread_Close_context *context)
Closes the thread.
struct Per_CPU_Control * cpu
This field references the processor of this watchdog control.
uint64_t Priority_Control
The thread priority control.
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Thread_Life_state
Thread life states.
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
static __inline__ void _Thread_Wait_restore_default(Thread_Control *the_thread)
Restores the default thread wait queue and operations.
static __inline__ bool _Thread_Is_life_change_allowed(Thread_Life_state life_state)
Checks if the thread life state allos life change.
Thread_Wait_information Wait
#define _ISR_Local_disable(_level)
Disables interrupts on this processor.
static __inline__ Objects_Control * _Objects_Allocate_unprotected(Objects_Information *information)
Allocates an object without locking the allocator mutex.
Thread queue context for the thread queue methods.
static __inline__ bool _Chain_Is_node_off_chain(const Chain_Node *node)
Checks if the node is off chain.
static __inline__ 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.
The priority node to build up a priority aggregation.
struct _Thread_Control * executing
This is the thread executing on this processor.
Thread entry information.
static __inline__ void _Thread_State_release_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Release the lock context in a critical section.
Scheduler_Node * next_request
Link to the next scheduler node in the Thread_Control::Scheduler::requests list.
void _Thread_Kill_zombies(void)
Kills all zombie threads in the system.
static __inline__ bool _Thread_Is_heir(const Thread_Control *the_thread)
Checks if the thread is the heir.
static __inline__ void _Thread_State_acquire_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the lock context in a critical section.
static __inline__ const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
Data Related to the Management of Processor Interrupt Levels.
static __inline__ void _Chain_Initialize_node(Chain_Node *the_node)
Initializes a chain node.
Inlined Routines in the Watchdog Handler.
Objects_Information **const _Objects_Information_table[OBJECTS_APIS_LAST+1]
static __inline__ void _Thread_Pin(Thread_Control *executing)
Pin the executing thread.
static __inline__ void _Thread_Unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
static __inline__ 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...
static __inline__ bool _Thread_Is_executing_on_a_processor(const Thread_Control *the_thread)
Checks if the thread executes currently on some processor in the system.
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.
struct Per_CPU_Control * cpu
The processor assigned by the current scheduler.
static __inline__ bool _Thread_Is_life_restarting(Thread_Life_state life_state)
Checks if the thread life state is restarting.
static __inline__ 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.
static __inline__ void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread's resource count.
void _Thread_Exit(Thread_Control *executing, Thread_Life_state set, void *exit_value)
Exits the currently executing thread.
The control block used to manage each watchdog timer.
void _Thread_Do_unpin(Thread_Control *executing, Per_CPU_Control *cpu_self)
Unpins the thread.
static __inline__ Thread_Control * _Thread_Wait_acquire_default_for_executing(ISR_lock_Context *lock_context)
Acquires the thread wait default lock and returns the executing thread.
void _Thread_Entry_adaptor_pointer(Thread_Control *executing)
Calls the start kinds pointer entry of the thread.
static __inline__ 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.
Priority_Control priority
The priority value of this node.
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
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.
Thread_Scheduler_control Scheduler
Scheduler related control.
void _Thread_Priority_and_sticky_update(Thread_Control *the_thread, int sticky_level_change)
Updates the priority of the thread and changes it sticky level.
static __inline__ Thread_Wait_flags _Thread_Wait_flags_get(const Thread_Control *the_thread)
Gets the thread's wait flags according to the ATOMIC_ORDER_RELAXED.
static __inline__ void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread's resource count.
Scheduler_Node_request
The scheduler node requests.
static __inline__ 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.
static __inline__ void _Thread_queue_Queue_release_critical(Thread_queue_Queue *queue, ISR_lock_Context *lock_context)
Releases the thread queue queue in a critical section.
Thread_Control * _Thread_Get(Objects_Id id, ISR_lock_Context *lock_context)
Gets a thread by its identifier.
static __inline__ void _Thread_State_release(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context and enables interrupts.
struct Scheduler_Node::@19 Thread
Block to register and manage this scheduler node in the thread control block of the owner of this sch...
static __inline__ bool _Thread_Is_null(const Thread_Control *the_thread)
Checks if the thread is NULL.
static __inline__ void _Thread_Timer_initialize(Thread_Timer_information *timer, Per_CPU_Control *cpu)
Initializes the thread timer.
bool _Thread_Initialize(Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
Initializes thread.
Helpers for Manipulating Timestamps.
#define _ISR_Get_level()
Return current interrupt level.
Timestamp_Control cpu_usage_timestamp
The CPU usage timestamp contains the time point of the last heir thread change or last CPU usage upda...
static __inline__ void _Thread_queue_Gate_close(Thread_queue_Gate *gate)
Closes the gate.
Scheduler_Node * requests
List of pending scheduler node requests.
static __inline__ void _Thread_Restore_fp(Thread_Control *executing)
Restores the executing thread's floating point area.
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Thread_queue_Queue * queue
The thread queue in case the thread is blocked on a thread queue.
Scheduler_Node_request request
The current scheduler node request.
Objects_Name name
Name of the object for the thread.
static __inline__ void _Watchdog_Preinitialize(Watchdog_Control *the_watchdog, Per_CPU_Control *cpu)
Pre-initializes a watchdog.
There is a pending scheduler node request to remove this scheduler node from the Thread_Control::Sche...
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.
Information for the Assert Handler.
There is a pending scheduler node request to add this scheduler node to the Thread_Control::Scheduler...
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.
static __inline__ void _Thread_Scheduler_add_request(Thread_Control *the_thread, Scheduler_Node *scheduler_node, Scheduler_Node_request request)
Add a scheduler request to the thread.
Chain_Node Wait_node
Node to add this scheduler node to Thread_Control::Scheduler::Wait_nodes.
static __inline__ void _Thread_queue_Gate_open(Thread_queue_Gate *gate)
Opens the gate.
static __inline__ 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).
static __inline__ void _Chain_Append_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Appends a node (unprotected).
static __inline__ void _Timestamp_Subtract(const Timestamp_Control *_start, const Timestamp_Control *_end, Timestamp_Control *_result)
Subtracts two timestamps.
Inlined Routines in the Object Handler.
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 ...
static __inline__ void _Thread_Action_initialize(Thread_Action *action)
Initializes the Thread action.
struct Thread_queue_Lock_context::@28 Wait
Data to support thread queue enqueue operations.
static __inline__ 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...
void _Thread_Timeout(Watchdog_Control *the_watchdog)
General purpose thread wait timeout.
static __inline__ void _Thread_Save_fp(Thread_Control *executing)
Checks if the floating point context of the thread is currently loaded in the floating point unit...
static __inline__ void _Thread_Wait_flags_set(Thread_Control *the_thread, Thread_Wait_flags flags)
Sets the thread's wait flags.
Priority_Control priority
The new thread's priority.
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
static __inline__ void _Thread_Scheduler_cancel_need_for_help(Thread_Control *the_thread, Per_CPU_Control *cpu)
Cancels the thread's need for help.
unsigned int Thread_Wait_flags
This type is able to contain several flags used to control the wait class and state of a thread...
Thread_queue_Gate Gate
Gate to synchronize thread wait lock requests.
int pin_level
The thread pinning to current processor level.
Control block to manage thread actions.
const struct _Scheduler_Control * scheduler
The scheduler control instance for the thread.
static __inline__ void _Thread_Timer_remove(Thread_Control *the_thread)
Remove the watchdog timer from the thread.
Objects_Id _Thread_Global_constructor
Object identifier of the global constructor thread.
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
States_Control _Thread_Set_state_locked(Thread_Control *the_thread, States_Control state)
Sets the specified thread state without locking the lock context.
The scheduler node is not on the list of pending requests.
static __inline__ Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
static __inline__ void _Thread_Wait_acquire(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait default lock and disables interrupts.
The configuration of a new thread to initialize.
static __inline__ Chain_Node * _Chain_Next(const Chain_Node *the_node)
Returns pointer to the next node from this node.
static __inline__ void _Thread_queue_Gate_wait(Thread_queue_Gate *gate)
Waits on a gate to open.
static __inline__ bool _Thread_Is_context_switch_necessary(void)
Deallocates the currently loaded floating point context.
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
static __inline__ void _Thread_Wait_remove_request(Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
Removes a thread wait lock request.
void _Thread_Start_multitasking(void) RTEMS_NO_RETURN
Starts thread multitasking.
static __inline__ void _Thread_Set_CPU(Thread_Control *thread, Per_CPU_Control *cpu)
Sets the cpu of the thread's scheduler.
void _Thread_Create_idle(void)
Creates idle thread.
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
static __inline__ 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.
size_t stack_size
The size of the stack area in bytes.
Objects_Id _Thread_Wait_get_id(const Thread_Control *the_thread)
Returns the object identifier of the object containing the current thread wait queue.
Thread_queue_Extract_operation extract
Thread queue extract operation.
Thread_CPU_budget_algorithm_callout budget_callout
The thread's initial budget callout.
#define _ISR_Local_enable(_level)
Enables interrupts on this processor.
static __inline__ void _Timestamp_Add_to(Timestamp_Control *_time, const Timestamp_Control *_add)
Adds two timestamps.
struct Per_CPU_Control::@13 Watchdog
Watchdog state for this processor.
Constants and Structures Associated with the Manipulation of Objects.
States_Control _Thread_Clear_state(Thread_Control *the_thread, States_Control state)
Clears the specified thread state.
static __inline__ void _Chain_Extract_unprotected(Chain_Node *the_node)
Extracts this node (unprotected).
States_Control current_state
static __inline__ void _Thread_Dispatch_request(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target)
Requests a thread dispatch on the target processor.
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...
#define SCHEDULER_PRIORITY_UNMAP(priority)
Returns the plain priority value.
static __inline__ bool _Thread_Priority_less_than(Priority_Control left, Priority_Control right)
Checks if the left thread priority is less than the right thread priority in the intuitive sense of p...
Chain_Node Help_node
Node for the Per_CPU_Control::Threads_in_need_for_help chain.
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
static __inline__ void _Thread_Scheduler_acquire_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the lock context in a critical section.
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
static __inline__ void _Thread_Scheduler_release_critical(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Releases the lock context in a critical section.
static __inline__ Priority_Control _Thread_Get_priority(const Thread_Control *the_thread)
Returns the priority of the thread.
static __inline__ 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...
static __inline__ void _Thread_Wait_acquire_default(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Acquires the thread wait default lock and disables interrupts.
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
static __inline__ void _Priority_Node_set_priority(Priority_Node *node, Priority_Control priority)
Sets the priority of the priority node to the given priority.
States_Control _Thread_Set_state(Thread_Control *the_thread, States_Control state)
Sets the specified thread state.
void _Thread_Iterate(Thread_Visitor visitor, void *arg)
Calls the visitor with all threads and the given argument until it is done.
static __inline__ void _Thread_Wait_release_queue_critical(Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
Releases the wait queue inside a critical section.
static __inline__ bool _States_Is_ready(States_Control the_states)
Checks if the state is ready.
Thread_CPU_budget_algorithms
static __inline__ 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.
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.
static __inline__ bool _Thread_Is_executing(const Thread_Control *the_thread)
Checks if the thread is the currently executing thread.
Inlined Routines Associated with Thread State Information.
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
static __inline__ bool _Thread_Is_joinable(const Thread_Control *the_thread)
Checks if the thread is joinable.
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
const size_t _Scheduler_Node_size
The size of a scheduler node.
struct _Thread_Control * heir
This is the heir thread for this processor.
struct Scheduler_Node::@20 Wait
Thread wait support block.
void _Thread_Entry_adaptor_idle(Thread_Control *executing)
Calls the start kinds idle entry of the thread.
static __inline__ Per_CPU_Control * _Thread_Get_CPU(const Thread_Control *thread)
Gets the cpu of the thread's scheduler.
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.
void _Thread_Entry_adaptor_numeric(Thread_Control *executing)
Calls the start kinds numeric entry of the thread.
static __inline__ void _Chain_Initialize_empty(Chain_Control *the_chain)
Initializes this chain as empty.
static __inline__ Priority_Control _Thread_Get_unmapped_real_priority(const Thread_Control *the_thread)
Returns the unmapped real priority of the thread.
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.
static __inline__ void _Thread_Wait_tranquilize(Thread_Control *the_thread)
Tranquilizes the thread after a wait on a thread queue.
States_Control _Thread_Clear_state_locked(Thread_Control *the_thread, States_Control state)
Clears the specified thread state without locking the lock context.
bool is_fp
Indicates whether the thread needs a floating-point area.
System State Handler API.
void * stack_area
The starting address of the stack area.
void _Thread_Handler(void)
Wrapper function for all threads.
void(* Thread_CPU_budget_algorithm_callout)(Thread_Control *)
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
static __inline__ 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.
Scheduler node for per-thread data.
bool _Thread_Start(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Starts the specified thread.
The thread queue gate is an SMP synchronization means.
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
static __inline__ Priority_Control _Thread_Get_unmapped_priority(const Thread_Control *the_thread)
Returns the unmapped priority of the thread.
static __inline__ Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
static __inline__ Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
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...
bool is_preemptible
Indicates whether the new thread is preemptible.
static __inline__ Thread_Control * _Thread_State_acquire_for_executing(ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock context for the currently executing thread.
static __inline__ 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).
static __inline__ uint32_t _Thread_Get_maximum_internal_threads(void)
Gets the maximum number of internal threads.
void _Thread_Handler_initialization(void)
Initializes thread handler.
static __inline__ void _Chain_Set_off_chain(Chain_Node *node)
Sets off chain.
static __inline__ void _Thread_Dispatch_update_heir(Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_for_heir, Thread_Control *heir)
Updates the used cpu time for the heir and dispatches a new heir.
Chain_Control Wait_nodes
Scheduler nodes immediately available to the thread by its home scheduler and due to thread queue own...
Scheduler_Node * nodes
The scheduler nodes of this thread.
static __inline__ bool _Thread_Is_life_terminating(Thread_Life_state life_state)
Checks if the thread life state is terminating.
static __inline__ void _Thread_Scheduler_remove_wait_node(Thread_Control *the_thread, Scheduler_Node *scheduler_node)
Remove a wait node from the thread and add a corresponding request to it.
static __inline__ Thread_Control * _Thread_Internal_allocate(void)
Allocates an internal thread and returns it.
Local ISR lock context for acquire and release pairs.
static __inline__ void _Thread_Wait_release(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Releases the thread wait lock and restores the previous interrupt status.
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
static __inline__ 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...
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
static __inline__ bool _Thread_Is_life_changing(Thread_Life_state life_state)
Checks if the thread life state is life changing.
Index for tick clock per-CPU watchdog header.
static __inline__ 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).
static __inline__ bool _Thread_Is_ready(const Thread_Control *the_thread)
Checks if the thread is ready.
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.
#define rtems_configuration_get_maximum_processors()
Returns the maximum number of processors which are configured for this application.
static __inline__ 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...
void _Thread_Cancel(Thread_Control *the_thread, Thread_Control *executing, void *exit_value)
Cancels the thread.
ISR_lock_Control Lock
Lock to protect the scheduler node change requests.
uint32_t isr_level
The thread's initial ISR level.
Context_Control Registers
static __inline__ void _Thread_Wait_cancel(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Cancels a thread wait on a thread queue.
static __inline__ bool _Objects_Is_api_valid(uint32_t the_api)
Checks if the api is valid.
The scheduler node is on the list of pending requests, but nothing should change. ...
Thread_Information _Thread_Information
The internal thread objects information.
static __inline__ 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).
#define RTEMS_PREDICT_TRUE(_exp)
Returns the value of the specified integral expression and tells the compiler that the predicted valu...
static __inline__ bool _Chain_Is_empty(const Chain_Control *the_chain)
Checks if the chain is empty.
static __inline__ void _Thread_State_acquire(Thread_Control *the_thread, ISR_lock_Context *lock_context)
Disables interrupts and acquires the lock_context.
static __inline__ 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).
Thread_Life_control Life
Thread life-cycle control.
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
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.
static __inline__ void _Thread_Wait_claim(Thread_Control *the_thread, Thread_queue_Queue *queue)
Claims the thread wait queue.
size_t _Thread_Get_name(const Thread_Control *the_thread, char *buffer, size_t buffer_size)
Gets the name of the thread.
static __inline__ Objects_APIs _Objects_Get_API(Objects_Id id)
Returns the API portion of the ID.
static __inline__ 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. ...
static __inline__ void _Thread_Wait_acquire_queue_critical(Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
Acquires the wait queue inside a critical section.
static __inline__ Chain_Node * _Chain_Tail(Chain_Control *the_chain)
Returns pointer to chain tail.
static __inline__ void _Thread_queue_Gate_add(Chain_Control *chain, Thread_queue_Gate *gate)
Adds the gate to the chain.
static __inline__ void _Thread_Scheduler_add_wait_node(Thread_Control *the_thread, Scheduler_Node *scheduler_node)
Adds a wait node to the thread and adds a corresponding request to the thread.
static __inline__ const Chain_Node * _Chain_Immutable_tail(const Chain_Control *the_chain)
Returns pointer to immutable chain tail.
void _Thread_Initialize_information(Thread_Information *information)
Initializes the thread information.
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG.
static __inline__ void _Thread_Update_CPU_time_used(Thread_Control *the_thread, Per_CPU_Control *cpu)
Updates the cpu time used of the thread.
static __inline__ Thread_Control * _Thread_Get_heir_and_make_it_executing(Per_CPU_Control *cpu_self)
Gets the heir of the processor and makes it executing.
Thread_Timer_information Timer
bool _Thread_Restart_other(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
static __inline__ void _Thread_Wait_remove_request_locked(Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
Removes the first pending wait lock request.