40#ifndef _RTEMS_SCORE_THREADIMPL_H
41#define _RTEMS_SCORE_THREADIMPL_H
57#include <rtems/config.h>
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 );
806 priority_group_order,
811#if defined(RTEMS_SMP)
824void _Thread_Priority_replace(
844#if defined(RTEMS_SMP)
851void _Thread_Priority_update_and_make_sticky(
Thread_Control *the_thread );
859void _Thread_Priority_update_and_clean_sticky(
Thread_Control *the_thread );
866void _Thread_Priority_update_ignore_sticky(
Thread_Control *the_thread );
879static inline bool _Thread_Priority_less_than(
901 return _Thread_Priority_less_than( left, right ) ? right : left;
922 the_api = _Objects_Get_API(
id );
924 if ( !_Objects_Is_api_valid( the_api ) ) {
951 the_api = (size_t) _Objects_Get_API( the_thread->
Object.
id );
952 _Assert( _Objects_Is_api_valid( the_api ) );
992#if defined(RTEMS_SMP)
997 return _Per_CPU_Get();
1007static inline void _Thread_Set_CPU(
1012#if defined(RTEMS_SMP)
1031static inline bool _Thread_Is_executing (
1035 return ( the_thread == _Thread_Executing );
1038#if defined(RTEMS_SMP)
1051static inline bool _Thread_Is_executing_on_a_processor(
1055 return _CPU_Context_Get_is_executing( &the_thread->
Registers );
1070static inline bool _Thread_Is_heir (
1074 return ( the_thread == _Thread_Heir );
1086static inline void _Thread_Unblock (
1108#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1109static inline bool _Thread_Is_allocated_fp (
1137#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1138#if ( CPU_USE_DEFERRED_FP_SWITCH != TRUE )
1150static inline void _Thread_Restore_fp(
Thread_Control *executing )
1152#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1153#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
1155 !_Thread_Is_allocated_fp( executing ) ) {
1174#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
1175static inline void _Thread_Deallocate_fp(
void )
1190static inline bool _Thread_Is_context_switch_necessary(
void )
1192 return ( _Thread_Dispatch_necessary );
1200static inline uint32_t _Thread_Get_maximum_internal_threads(
void)
1203 uint32_t maximum_internal_threads =
1207#if defined(RTEMS_MULTIPROCESSING)
1208 if ( _System_state_Is_multiprocessing ) {
1209 ++maximum_internal_threads;
1213 return maximum_internal_threads;
1241static inline Thread_Control *_Thread_Get_heir_and_make_it_executing(
1247 heir = cpu_self->
heir;
1261static inline void _Thread_Update_CPU_time_used(
1282#if defined( RTEMS_SMP )
1283static inline void _Thread_Dispatch_update_heir(
1289 _Thread_Update_CPU_time_used( cpu_for_heir->
heir, cpu_for_heir );
1291 cpu_for_heir->
heir = heir;
1293 _Thread_Dispatch_request( cpu_self, cpu_for_heir );
1340static inline void _Thread_Action_control_initialize(
1344 _Chain_Initialize_empty( &action_control->Chain );
1352static inline void _Thread_Action_initialize(
1356 _Chain_Set_off_chain( &action->Node );
1371static inline void _Thread_Add_post_switch_action(
1379 _Assert( _Thread_State_is_owner( the_thread ) );
1381 cpu_of_thread = _Thread_Get_CPU( the_thread );
1383 action->handler = handler;
1385 _Thread_Dispatch_request( _Per_CPU_Get(), cpu_of_thread );
1387 _Chain_Append_if_is_off_chain_unprotected(
1388 &the_thread->Post_switch_actions.Chain,
1404static inline void _Thread_Append_post_switch_action(
1409 _Assert( _Thread_State_is_owner( the_thread ) );
1412 _Chain_Append_unprotected(
1413 &the_thread->Post_switch_actions.Chain,
1426static inline bool _Thread_Is_life_restarting(
1441static inline bool _Thread_Is_life_terminating(
1456static inline bool _Thread_Is_life_change_allowed(
1472static inline bool _Thread_Is_life_changing(
1488static inline bool _Thread_Is_joinable(
1492 _Assert( _Thread_State_is_owner( the_thread ) );
1501static inline void _Thread_Resource_count_increment(
1505#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1506 ++the_thread->resource_count;
1517static inline void _Thread_Resource_count_decrement(
1521#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1522 --the_thread->resource_count;
1528#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
1540static inline bool _Thread_Owns_resources(
1544 return the_thread->resource_count != 0;
1559#if defined(RTEMS_SMP)
1560 return the_thread->
Scheduler.home_scheduler;
1578#if defined(RTEMS_SMP)
1580 return SCHEDULER_NODE_OF_THREAD_WAIT_NODE(
1581 _Chain_First( &the_thread->
Scheduler.Wait_nodes )
1596static inline Scheduler_Node *_Thread_Scheduler_get_node_by_index(
1598 size_t scheduler_index
1602#if defined(RTEMS_SMP)
1605 + scheduler_index * _Scheduler_Node_size );
1607 (void) scheduler_index;
1612#if defined(RTEMS_SMP)
1619static inline void _Thread_Scheduler_acquire_critical(
1633static inline void _Thread_Scheduler_release_critical(
1646void _Thread_Scheduler_process_requests(
Thread_Control *the_thread );
1655static inline void _Thread_Scheduler_add_request(
1658 Scheduler_Node_request request
1662 Scheduler_Node_request current_request;
1664 _Thread_Scheduler_acquire_critical( the_thread, &lock_context );
1666 current_request = scheduler_node->Thread.request;
1668 if ( current_request == SCHEDULER_NODE_REQUEST_NOT_PENDING ) {
1670 request == SCHEDULER_NODE_REQUEST_ADD
1671 || request == SCHEDULER_NODE_REQUEST_REMOVE
1673 _Assert( scheduler_node->Thread.next_request ==
NULL );
1674 scheduler_node->Thread.next_request = the_thread->
Scheduler.requests;
1675 the_thread->
Scheduler.requests = scheduler_node;
1676 }
else if ( current_request != SCHEDULER_NODE_REQUEST_NOTHING ) {
1678 ( current_request == SCHEDULER_NODE_REQUEST_ADD
1679 && request == SCHEDULER_NODE_REQUEST_REMOVE )
1680 || ( current_request == SCHEDULER_NODE_REQUEST_REMOVE
1681 && request == SCHEDULER_NODE_REQUEST_ADD )
1683 request = SCHEDULER_NODE_REQUEST_NOTHING;
1686 scheduler_node->Thread.request = request;
1688 _Thread_Scheduler_release_critical( the_thread, &lock_context );
1698static inline void _Thread_Scheduler_add_wait_node(
1703 _Chain_Append_unprotected(
1705 &scheduler_node->Thread.Wait_node
1707 _Thread_Scheduler_add_request(
1710 SCHEDULER_NODE_REQUEST_ADD
1721static inline void _Thread_Scheduler_remove_wait_node(
1726 _Chain_Extract_unprotected( &scheduler_node->Thread.Wait_node );
1727 _Thread_Scheduler_add_request(
1730 SCHEDULER_NODE_REQUEST_REMOVE
1752 scheduler_node = _Thread_Scheduler_get_home_node( the_thread );
1753 return _Priority_Get_priority( &scheduler_node->
Wait.Priority );
1794static inline void _Thread_Wait_acquire_default_critical(
1813static inline Thread_Control *_Thread_Wait_acquire_default_for_executing(
1820 executing = _Thread_Executing;
1821 _Thread_Wait_acquire_default_critical( executing, lock_context );
1835static inline void _Thread_Wait_acquire_default(
1841 _Thread_Wait_acquire_default_critical( the_thread, lock_context );
1854static inline void _Thread_Wait_release_default_critical(
1870static inline void _Thread_Wait_release_default(
1875 _Thread_Wait_release_default_critical( the_thread, lock_context );
1879#if defined(RTEMS_SMP)
1880#define THREAD_QUEUE_CONTEXT_OF_REQUEST( node ) \
1881 RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
1889static inline void _Thread_Wait_remove_request_locked(
1896 _Chain_Extract_unprotected( &queue_lock_context->Wait.Gate.Node );
1897 first = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
1899 if ( first != _Chain_Tail( &the_thread->
Wait.Lock.Pending_requests ) ) {
1900 _Thread_queue_Gate_open( (Thread_queue_Gate *) first );
1910static inline void _Thread_Wait_acquire_queue_critical(
1915 _Thread_queue_Queue_acquire_critical(
1917 &_Thread_Executing->Potpourri_stats,
1928static inline void _Thread_Wait_release_queue_critical(
1933 _Thread_queue_Queue_release_critical(
1948static inline void _Thread_Wait_acquire_critical(
1953#if defined(RTEMS_SMP)
1956 _Thread_Wait_acquire_default_critical(
1964 if ( queue !=
NULL ) {
1965 _Thread_queue_Gate_add(
1966 &the_thread->
Wait.Lock.Pending_requests,
1969 _Thread_Wait_release_default_critical(
1973 _Thread_Wait_acquire_queue_critical( queue, &queue_context->
Lock_context );
1976 _Thread_Wait_release_queue_critical(
1980 _Thread_Wait_acquire_default_critical(
1984 _Thread_Wait_remove_request_locked(
1993 (void) queue_context;
2004static inline void _Thread_Wait_acquire(
2010 _Thread_Wait_acquire_critical( the_thread, queue_context );
2023static inline void _Thread_Wait_release_critical(
2028#if defined(RTEMS_SMP)
2033 if ( queue !=
NULL ) {
2034 _Thread_Wait_release_queue_critical(
2037 _Thread_Wait_acquire_default_critical(
2041 _Thread_Wait_remove_request_locked(
2047 _Thread_Wait_release_default_critical(
2053 (void) queue_context;
2065static inline void _Thread_Wait_release(
2070 _Thread_Wait_release_critical( the_thread, queue_context );
2088static inline void _Thread_Wait_claim(
2095 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2099#if defined(RTEMS_SMP)
2100 _Chain_Initialize_empty( &the_thread->
Wait.Lock.Pending_requests );
2101 _Chain_Initialize_node( &the_thread->
Wait.Lock.Tranquilizer.Node );
2102 _Thread_queue_Gate_close( &the_thread->
Wait.Lock.Tranquilizer );
2107 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2117static inline void _Thread_Wait_claim_finalize(
2136static inline void _Thread_Wait_remove_request(
2141#if defined(RTEMS_SMP)
2144 _Thread_Wait_acquire_default( the_thread, &lock_context );
2145 _Thread_Wait_remove_request_locked( the_thread, queue_lock_context );
2146 _Thread_Wait_release_default( the_thread, &lock_context );
2149 (void) queue_lock_context;
2165static inline void _Thread_Wait_restore_default(
2169#if defined(RTEMS_SMP)
2174 _Thread_Wait_acquire_default_critical( the_thread, &lock_context );
2176 node = _Chain_First( &the_thread->
Wait.Lock.Pending_requests );
2177 tail = _Chain_Immutable_tail( &the_thread->
Wait.Lock.Pending_requests );
2179 if ( node != tail ) {
2183 queue_context = THREAD_QUEUE_CONTEXT_OF_REQUEST( node );
2186 node = _Chain_Next( node );
2187 }
while ( node != tail );
2189 _Thread_queue_Gate_add(
2190 &the_thread->
Wait.Lock.Pending_requests,
2191 &the_thread->
Wait.Lock.Tranquilizer
2194 _Thread_queue_Gate_open( &the_thread->
Wait.Lock.Tranquilizer );
2201#if defined(RTEMS_SMP)
2202 _Thread_Wait_release_default_critical( the_thread, &lock_context );
2224static inline void _Thread_Wait_tranquilize(
2228#if defined(RTEMS_SMP)
2229 _Thread_queue_Gate_wait( &the_thread->
Wait.Lock.Tranquilizer );
2242static inline void _Thread_Wait_cancel(
2251 if ( queue !=
NULL ) {
2252#if defined(RTEMS_SMP)
2261 _Thread_Wait_restore_default( the_thread );
2263#if defined(RTEMS_SMP)
2273#define THREAD_WAIT_STATE_MASK 0xffU
2282#define THREAD_WAIT_STATE_READY 0x0U
2291#define THREAD_WAIT_STATE_INTEND_TO_BLOCK 0x1U
2296#define THREAD_WAIT_STATE_BLOCKED 0x2U
2301#define THREAD_WAIT_CLASS_MASK 0xff00U
2306#define THREAD_WAIT_CLASS_EVENT 0x100U
2311#define THREAD_WAIT_CLASS_SYSTEM_EVENT 0x200U
2316#define THREAD_WAIT_CLASS_OBJECT 0x400U
2321#define THREAD_WAIT_CLASS_PERIOD 0x800U
2329static inline void _Thread_Wait_flags_set(
2334#if defined(RTEMS_SMP)
2335 _Atomic_Store_uint( &the_thread->
Wait.
flags, flags, ATOMIC_ORDER_RELAXED );
2352#if defined(RTEMS_SMP)
2353 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_RELAXED );
2370#if defined(RTEMS_SMP)
2371 return _Atomic_Load_uint( &the_thread->
Wait.
flags, ATOMIC_ORDER_ACQUIRE );
2393static inline bool _Thread_Wait_flags_try_change_release(
2401#if defined(RTEMS_SMP)
2402 return _Atomic_Compare_exchange_uint(
2406 ATOMIC_ORDER_RELEASE,
2407 ATOMIC_ORDER_RELAXED
2410 bool success = ( the_thread->
Wait.
flags == expected_flags );
2433static inline bool _Thread_Wait_flags_try_change_acquire(
2439#if defined(RTEMS_SMP)
2440 return _Atomic_Compare_exchange_uint(
2444 ATOMIC_ORDER_ACQUIRE,
2445 ATOMIC_ORDER_ACQUIRE
2453 success = _Thread_Wait_flags_try_change_release(
2521static inline void _Thread_Timer_initialize(
2528 _Watchdog_Preinitialize( &timer->Watchdog, cpu );
2538static inline void _Thread_Add_timeout_ticks(
2548 the_thread->
Timer.header =
2551 _Watchdog_Per_CPU_insert_ticks( &the_thread->
Timer.Watchdog, cpu, ticks );
2564static inline void _Thread_Timer_insert_realtime(
2577 the_thread->
Timer.header = header;
2579 _Watchdog_Per_CPU_insert( &the_thread->
Timer.Watchdog, cpu, header, expire );
2589static inline void _Thread_Timer_remove(
Thread_Control *the_thread )
2595 _Watchdog_Per_CPU_remove(
2596 &the_thread->
Timer.Watchdog,
2597#
if defined(RTEMS_SMP)
2598 the_thread->
Timer.Watchdog.cpu,
2602 the_thread->
Timer.header
2615static inline void _Thread_Remove_timer_and_unblock(
2620 _Thread_Wait_tranquilize( the_thread );
2621 _Thread_Timer_remove( the_thread );
2623#if defined(RTEMS_MULTIPROCESSING)
2624 if ( _Objects_Is_local_id( the_thread->
Object.
id ) ) {
2625 _Thread_Unblock( the_thread );
2627 _Thread_queue_Unblock_proxy( queue, the_thread );
2631 _Thread_Unblock( the_thread );
2664#if defined(RTEMS_SMP)
2665#define THREAD_PIN_STEP 2
2667#define THREAD_PIN_PREEMPTION 1
2675void _Thread_Do_unpin(
2688#if defined(RTEMS_SMP)
2689 _Assert( executing == _Thread_Get_executing() );
2691 executing->
Scheduler.pin_level += THREAD_PIN_STEP;
2703static inline void _Thread_Unpin(
2708#if defined(RTEMS_SMP)
2709 unsigned int pin_level;
2711 _Assert( executing == _Per_CPU_Get_executing( cpu_self ) );
2713 pin_level = executing->
Scheduler.pin_level;
2718 pin_level != ( THREAD_PIN_STEP | THREAD_PIN_PREEMPTION )
2721 executing->
Scheduler.pin_level = pin_level - THREAD_PIN_STEP;
2723 _Thread_Do_unpin( executing, cpu_self );
2737#if defined(RTEMS_MULTIPROCESSING)
2755static inline void _Thread_Timer_remove_and_continue(
2760 _Thread_Timer_remove( the_thread );
2761#if defined(RTEMS_MULTIPROCESSING)
This header file provides the interfaces of the Assert Handler.
This header file provides interfaces of the Chain Handler which are only used by the implementation.
#define RTEMS_PREDICT_TRUE(_exp)
Evaluates the integral expression and tells the compiler that the predicted value is true (1).
Definition: basedefs.h:751
#define RTEMS_NO_RETURN
Tells the compiler in a function declaration that this function does not return.
Definition: basedefs.h:386
#define rtems_configuration_get_maximum_processors()
Gets the maximum number of processors configured for this application.
Definition: config.h:500
#define _Assert(_e)
Assertion similar to assert() controlled via RTEMS_DEBUG instead of NDEBUG and static analysis runs.
Definition: assert.h:96
#define _Context_Restore_fp(_fp)
Restore floating point context area.
Definition: context.h:159
#define _Context_Save_fp(_fp)
Save floating point context area.
Definition: context.h:170
#define _ISR_lock_ISR_enable(_context)
Restores the saved interrupt state of the ISR lock context.
Definition: isrlock.h:435
#define _ISR_lock_Release(_lock, _context)
Releases an ISR lock inside an ISR disabled section.
Definition: isrlock.h:332
#define _ISR_lock_ISR_disable(_context)
Disables interrupts and saves the previous interrupt state in the ISR lock context.
Definition: isrlock.h:414
#define _ISR_lock_Acquire(_lock, _context)
Acquires an ISR lock inside an ISR disabled section.
Definition: isrlock.h:309
#define _ISR_lock_Release_and_ISR_enable(_lock, _context)
Releases an ISR lock.
Definition: isrlock.h:279
#define _ISR_lock_ISR_disable_and_acquire(_lock, _context)
Acquires an ISR lock.
Definition: isrlock.h:254
#define _ISR_lock_Initialize(_lock, _name)
Initializes an ISR lock.
Definition: isrlock.h:201
#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:393
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:1478
Status_Control _Thread_Restart(Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
Restarts the thread.
Definition: threadrestart.c:535
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:500
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:433
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:381
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:317
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:222
#define THREAD_LIFE_TERMINATING
Indicates that thread is terminating.
Definition: thread.h:747
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:731
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:722
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:739
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:332
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:167
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:428
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:661
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:347
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:756
Thread_Life_state _Thread_Set_life_protection(Thread_Life_state state)
Set the thread to life protected.
Definition: threadrestart.c:623
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:765
Status_Control _Thread_Close(Thread_Control *the_thread, Thread_Control *executing, Thread_queue_Context *queue_context)
Closes the thread.
Definition: threadrestart.c:464
void _Thread_Load_environment(Thread_Control *the_thread)
Initializes enviroment for a thread.
Definition: threadloadenv.c:44
Status_Control _Thread_Set_name(Thread_Control *the_thread, const char *name)
Sets the name of the thread.
Definition: threadname.c:45
void _Thread_Handler(void)
Wrapper function for all threads.
Definition: threadhandler.c:97
Status_Control _Thread_Join(Thread_Control *the_thread, States_Control waiting_for_join, Thread_Control *executing, Thread_queue_Context *queue_context)
Joins the currently executing thread with the thread.
Definition: threadrestart.c:379
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:596
@ 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
#define NULL
Requests a GPIO pin group configuration.
Definition: xil_types.h:54
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:81
ISR lock control.
Definition: isrlock.h:72
Objects_Id id
Definition: objectdata.h:65
Per CPU Core Structure.
Definition: percpu.h:384
struct Per_CPU_Control::@4380 Watchdog
Watchdog state for this processor.
struct _Thread_Control * heir
This is the heir thread for this processor.
Definition: percpu.h:473
Watchdog_Header Header[PER_CPU_WATCHDOG_COUNT]
Header for watchdogs.
Definition: percpu.h:513
volatile bool dispatch_necessary
This is set to true when this processor needs to run the thread dispatcher.
Definition: percpu.h:437
Timestamp_Control cpu_usage_timestamp
The CPU usage timestamp contains the time point of the last heir thread change or last CPU usage upda...
Definition: percpu.h:489
struct _Thread_Control * executing
This is the thread executing on this processor.
Definition: percpu.h:457
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::@4383 Wait
Thread wait support block.
Control block to manage thread actions.
Definition: thread.h:708
Thread action.
Definition: thread.h:681
This structure contains operations which manage the CPU budget of a thread.
Definition: thread.h:165
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:140
Thread_Life_state state
The current thread life state.
Definition: thread.h:780
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:396
The thread zombie registry is used to register threads in the STATES_ZOMBIE state.
Definition: threadimpl.h:73
Chain_Control Chain
This chain contains the registered zombie threads.
Definition: threadimpl.h:84
Thread queue context for the thread queue methods.
Definition: threadq.h:216
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:221
Definition: threadq.h:143
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
Definition: threadq.h:148
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:554
Thread_queue_Extract_operation extract
This operation is used to extract the thread from the thread queue.
Definition: threadq.h:580
Definition: threadq.h:427
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
Watchdog_Service_routine_entry routine
This field is the function to invoke.
Definition: watchdog.h:133
Scheduler control.
Definition: scheduler.h:335
uint32_t name
The scheduler name.
Definition: scheduler.h:357
Context_Control Registers
This member contains the context of this thread.
Definition: thread.h:868
Objects_Control Object
Definition: thread.h:814
Timestamp_Control cpu_time_used
This member contains the amount of CPU time consumed by this thread since it was created.
Definition: thread.h:909
Thread_Wait_information Wait
Definition: thread.h:852
Context_Control_fp * fp_context
Definition: thread.h:929
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:839
States_Control current_state
Definition: thread.h:834
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:849
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:831
Thread_Timer_information Timer
Definition: thread.h:854
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:950
Definition: deflate.c:114
Definition: mmu-config.c:53
This header file provides the interfaces of the System State Handler.
This header file provides the interfaces of the Thread Handler Multiprocessing (MP) Support.
This header file provides interfaces of the Thread Queue Handler which are only used by the implement...
This header file provides interfaces of the Timestamp Handler which are only used by the implementati...
This header file provides the interfaces of the Time of Day Handler and the Time of Day Handler Actio...
This union represents a chain control block.
Definition: chain.h:96
This header file provides interfaces of the Watchdog Handler which are only used by the implementatio...