41#ifndef _RTEMS_SCORE_THREAD_H
42#define _RTEMS_SCORE_THREAD_H
46#if defined(RTEMS_MULTIPROCESSING)
66struct _pthread_cleanup_context;
98#if defined(RTEMS_DEBUG)
102#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
105#if defined(RTEMS_POSIX_API)
112#define RTEMS_SCORE_THREAD_REAL_PRIORITY_MAY_BE_INACTIVE
115#if defined(RTEMS_POSIX_API) && defined(RTEMS_SMP)
122#define RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS
140 void *( *entry )( uintptr_t argument );
156 void *( *entry )(
void *argument );
253 void ( *stack_free )(
void * );
256 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
264#if defined(RTEMS_SMP)
274 THREAD_SCHEDULER_BLOCKED,
283 THREAD_SCHEDULER_SCHEDULED,
290 THREAD_SCHEDULER_READY
291} Thread_Scheduler_state;
298#if defined(RTEMS_SMP)
302 ISR_lock_Control Lock;
307 Thread_Scheduler_state state;
377 size_t helping_nodes;
411 Processor_mask Affinity;
433 void *mutable_object;
434 const void *immutable_object;
460#if defined(RTEMS_MULTIPROCESSING)
487#if defined(RTEMS_SMP)
493#if defined(RTEMS_SMP)
515 ISR_lock_Control Default;
532 Thread_queue_Gate Tranquilizer;
539 Thread_queue_Link Link;
568#if ISR_LOCK_NEEDS_OBJECT
569 ISR_lock_Control Lock;
599#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
601 uint32_t resource_count;
613#if defined(RTEMS_MULTIPROCESSING)
621 Thread_queue_MP_callout thread_queue_callout;
660#define THREAD_API_FIRST THREAD_API_RTEMS
663#define THREAD_API_LAST THREAD_API_POSIX
720#if defined(RTEMS_SMP)
724 ISR_lock_Control Lock;
756#define THREAD_LIFE_PROTECTED 0x1U
764#define THREAD_LIFE_RESTARTING 0x2U
772#define THREAD_LIFE_TERMINATING 0x4U
781#define THREAD_LIFE_CHANGE_DEFERRED 0x8U
790#define THREAD_LIFE_DETACHED 0x10U
866#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
868 uint32_t resource_count;
880#if defined(RTEMS_MULTIPROCESSING)
895#if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
904 SMP_lock_Stats Potpourri_stats;
909#if defined(RTEMS_MULTIPROCESSING)
924#if defined(RTEMS_SCORE_THREAD_HAS_SCHEDULER_CHANGE_INHIBITORS)
931 bool is_scheduler_change_inhibited;
960#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
967#ifndef _REENT_THREAD_LOCAL
1020 rtems_per_thread_routine routine
1079#define THREAD_DEFAULT_MAXIMUM_NAME_SIZE 16
1113#if defined(RTEMS_SMP)
1124#if defined(RTEMS_SMP)
1127#define _Thread_queue_Heads_size sizeof(Thread_queue_Heads)
1156 } Thread_queue_heads;
1164#define THREAD_INFORMATION_DEFINE_ZERO( name, api, cls ) \
1165Thread_Information name##_Information = { \
1167 _Objects_Build_id( api, cls, 1, 0 ), \
1169 _Objects_Allocate_none, \
1175 CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
1179 OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ), \
1193#define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \
1194static Objects_Control * \
1195name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
1196static RTEMS_SECTION( ".noinit.rtems.content.objects." #name ) \
1197Thread_Configured_control \
1198name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
1199static RTEMS_SECTION( ".noinit.rtems.content.objects." #name ) \
1200Thread_queue_Configured_heads \
1201name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
1202Thread_Information name##_Information = { \
1204 _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
1205 name##_Local_table, \
1206 _Objects_Is_unlimited( max ) ? \
1207 _Thread_Allocate_unlimited : _Objects_Allocate_static, \
1208 _Objects_Is_unlimited( max ) ? \
1209 _Objects_Free_unlimited : _Objects_Free_static, \
1211 _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
1212 sizeof( Thread_Configured_control ), \
1213 OBJECTS_NO_STRING_NAME, \
1214 CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
1217 &name##_Objects[ 0 ].Control.Object \
1218 OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ) \
1220 &name##_Heads[ 0 ] \
1224#if defined(RTEMS_MULTIPROCESSING)
1231typedef struct Thread_Configured_proxy_control Thread_Configured_proxy_control;
1238extern Thread_Configured_proxy_control *
const _Thread_MP_Proxies;
This header file provides the interfaces of the Context Handler.
This header file provides interfaces of the Stack Handler which are used by the implementation and th...
This header file provides interfaces of the Watchdog Handler which are used by the implementation and...
This header file provides interfaces of the Freechain Handler which are used by the implementation an...
#define RTEMS_DEPRECATED
Instructs the compiler in a declaration to issue a warning whenever a variable, function,...
Definition: basedefs.h:334
#define RTEMS_ZERO_LENGTH_ARRAY
This constant represents the element count of a zero-length array.
Definition: basedefs.h:1032
uintptr_t CPU_Uint32ptr
Definition: cpu.h:557
uint32_t Objects_Id
Definition: object.h:101
uint64_t Priority_Control
The thread priority control.
Definition: priority.h:91
uint32_t States_Control
Definition: states.h:65
const size_t _Thread_Initial_thread_count
Count of configured threads.
Thread_Information _Thread_Information
The internal thread objects information.
const size_t _Thread_Maximum_TLS_size
If this constant is greater than zero, then it defines the maximum thread-local storage size,...
#define _Thread_queue_Heads_size
Size of the thread queue heads of a particular application.
Definition: thread.h:1127
void rtems_iterate_over_all_threads(rtems_per_thread_routine routine) RTEMS_DEPRECATED
Deprecated, use rtems_task_iterate() instead.
Definition: iterateoverthreads.c:57
const Thread_Control_add_on _Thread_Control_add_ons[]
Thread control add-ons.
unsigned int Thread_Life_state
This type represents the thread life state.
Definition: thread.h:747
const size_t _Thread_Control_add_on_count
Thread control add-on count.
unsigned int Thread_Wait_flags
This type is able to contain several flags used to control the wait class and state of a thread.
Definition: thread.h:451
void(* Thread_Action_handler)(Thread_Control *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)
This type defines the prototype of thread action handlers.
Definition: thread.h:686
CPU_Uint32ptr Thread_Entry_numeric_type
Type of the numeric argument of a thread entry function with at least one numeric argument.
Definition: thread.h:134
Objects_Control * _Thread_Allocate_unlimited(Objects_Information *information)
Return an inactive thread object or NULL.
Definition: threadallocateunlimited.c:70
Thread_queue_Heads Thread_queue_Configured_heads
The configured thread queue heads.
Definition: thread.h:1116
struct Thread_Configured_control Thread_Configured_control
The configured thread control block.
Definition: thread.h:1105
const size_t _Thread_Maximum_name_size
Maximum size of a thread name in characters (including the terminating '\0' character).
#define THREAD_API_LAST
Definition: thread.h:663
Thread_APIs
Definition: thread.h:652
@ THREAD_API_POSIX
Definition: thread.h:656
@ THREAD_API_RTEMS
Definition: thread.h:654
int64_t Timestamp_Control
Definition: timestamp.h:76
This header file provides the interfaces of the Atomic Operations.
This header file provides the interfaces of the ISR Locks.
This header file provides the interfaces of the Multiprocessing (MP) Packet Handler.
This header file provides data structures used by the implementation and the Application Configuratio...
This header file provides the interfaces of the Processor Mask.
This header file provides interfaces of the Priority Handler which are used by the implementation and...
This header file provides interfaces of the Scheduler Handler related to scheduler nodes which are us...
This header file provides interfaces of the Thread States which are used by the implementation and th...
This structure represents a chain node.
Definition: chain.h:78
SPARC basic context.
Definition: cpu.h:213
Thread register context.
Definition: cpu.h:173
The freechain control.
Definition: freechain.h:64
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:94
Definition: objectdata.h:61
Per CPU Core Structure.
Definition: percpu.h:384
The priority node to build up a priority aggregation.
Definition: priority.h:112
Red-black tree node.
Definition: rbtree.h:73
Scheduler node for per-thread data.
Definition: schedulernode.h:94
Control block to manage thread actions.
Definition: thread.h:733
Thread action.
Definition: thread.h:706
This structure is used to control the CPU budget of a thread.
Definition: thread.h:211
uint32_t available
This member contains the count of the time quantum that this thread is allowed to consume until an ac...
Definition: thread.h:224
const Thread_CPU_budget_operations * operations
If this member is not NULL, then it references the CPU budget operations used to manage the CPU budge...
Definition: thread.h:217
This structure contains operations which manage the CPU budget of a thread.
Definition: thread.h:188
Thread control add-on.
Definition: thread.h:1026
size_t source_offset
Offset relative to the thread control block begin to an application configuration dependent memory ar...
Definition: thread.h:1038
size_t destination_offset
Offset of the pointer field in Thread_Control referencing an application configuration dependent memo...
Definition: thread.h:1032
Data for idle thread entry.
Definition: thread.h:139
Thread entry information.
Definition: thread.h:163
Data for thread entry with one numeric argument and no return value.
Definition: thread.h:146
Data for thread entry with one pointer argument and a pointer return value.
Definition: thread.h:155
Thread life control.
Definition: thread.h:795
uint32_t pending_life_change_requests
The count of pending life change requests.
Definition: thread.h:810
Thread_Action Action
Thread life action used to react upon thread restart and delete requests.
Definition: thread.h:800
Thread_Life_state state
The current thread life state.
Definition: thread.h:805
void * exit_value
The thread exit value.
Definition: thread.h:820
States_Control current_state
Definition: thread.h:592
Objects_Control Object
Definition: thread.h:584
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:597
Thread_Timer_information Timer
Definition: thread.h:612
Thread_Wait_information Wait
Definition: thread.h:610
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:607
Thread_queue_Control Join_queue
Definition: thread.h:589
Thread scheduler control.
Definition: thread.h:297
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:419
Definition: threadq.h:609
The thread queue operations are used to manage the threads of a thread queue.
Definition: threadq.h:554
Definition: threadq.h:427
Chain iterator for dynamic user extensions.
Definition: userextimpl.h:66
The control block used to manage each watchdog timer.
Definition: watchdog.h:109
Scheduler control.
Definition: scheduler.h:337
Context_Control Registers
This member contains the context of this thread.
Definition: thread.h:893
Objects_Control Object
Definition: thread.h:839
struct User_extensions_Iterator * last_user_extensions_iterator
LIFO list of user extensions iterators.
Definition: thread.h:1002
Timestamp_Control cpu_time_used
This member contains the amount of CPU time consumed by this thread since it was created.
Definition: thread.h:944
Thread_Wait_information Wait
Definition: thread.h:877
Context_Control_fp * fp_context
Definition: thread.h:964
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:864
Thread_Keys_information Keys
The POSIX Keys information.
Definition: thread.h:978
States_Control current_state
Definition: thread.h:859
bool is_fp
Definition: thread.h:916
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:874
Thread_queue_Control Join_queue
Thread queue for thread join operations and multi-purpose lock.
Definition: thread.h:856
void * API_Extensions[THREAD_API_LAST+1]
Definition: thread.h:973
Thread_Timer_information Timer
Definition: thread.h:879
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:985
Thread_CPU_budget_control CPU_budget
This member contains the CPU budget control used to manage the CPU budget of the thread.
Definition: thread.h:938
bool was_created_with_inherited_scheduler
True, if the thread was created with an inherited scheduler (PTHREAD_INHERIT_SCHED),...
Definition: thread.h:922
struct _pthread_cleanup_context * last_cleanup_context
LIFO list of POSIX cleanup contexts.
Definition: thread.h:997
bool is_preemptible
Definition: thread.h:914
Thread_Start_information Start
Definition: thread.h:956
Timestamp_Control cpu_time_used_at_last_reset
This member contains the amount of CPU time consumed by this thread at the time of the last reset of ...
Definition: thread.h:951
void * extensions[RTEMS_ZERO_LENGTH_ARRAY]
Variable length array of user extension pointers.
Definition: thread.h:1009
bool is_idle
Definition: thread.h:908
struct rtems_user_env_t * user_environment
Pointer to an optional thread-specific POSIX user environment.
Definition: thread.h:992
struct _reent * libc_reent
Definition: thread.h:969
Thread queue heads.
Definition: threadq.h:385
Definition: intercom.c:87
Definition: mmu-config.c:53
User environment.
Definition: userenv.h:80
This header file provides interfaces of the Thread Queue Handler which are used by the implementation...
This header file provides interfaces of the Timestamp Handler which are used by the implementation an...
This union represents a chain control block.
Definition: chain.h:96