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)
99#define RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT
117 void *( *entry )( uintptr_t argument );
133 void *( *entry )(
void *argument );
230 void ( *stack_free )(
void * );
233 #if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
241#if defined(RTEMS_SMP)
251 THREAD_SCHEDULER_BLOCKED,
260 THREAD_SCHEDULER_SCHEDULED,
267 THREAD_SCHEDULER_READY
268} Thread_Scheduler_state;
275#if defined(RTEMS_SMP)
284 Thread_Scheduler_state state;
354 size_t helping_nodes;
388 Processor_mask Affinity;
410 void *mutable_object;
411 const void *immutable_object;
437#if defined(RTEMS_MULTIPROCESSING)
464#if defined(RTEMS_SMP)
470#if defined(RTEMS_SMP)
509 Thread_queue_Gate Tranquilizer;
516 Thread_queue_Link Link;
574#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
576 uint32_t resource_count;
588#if defined(RTEMS_MULTIPROCESSING)
596 Thread_queue_MP_callout thread_queue_callout;
635#define THREAD_API_FIRST THREAD_API_RTEMS
638#define THREAD_API_LAST THREAD_API_POSIX
695#if defined(RTEMS_SMP)
731#define THREAD_LIFE_PROTECTED 0x1U
739#define THREAD_LIFE_RESTARTING 0x2U
747#define THREAD_LIFE_TERMINATING 0x4U
756#define THREAD_LIFE_CHANGE_DEFERRED 0x8U
765#define THREAD_LIFE_DETACHED 0x10U
841#if defined(RTEMS_SCORE_THREAD_ENABLE_RESOURCE_COUNT)
843 uint32_t resource_count;
855#if defined(RTEMS_MULTIPROCESSING)
870#if defined(RTEMS_SMP) && defined(RTEMS_PROFILING)
879 SMP_lock_Stats Potpourri_stats;
884#if defined(RTEMS_MULTIPROCESSING)
925#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
932#ifndef _REENT_THREAD_LOCAL
985 rtems_per_thread_routine routine
1044#define THREAD_DEFAULT_MAXIMUM_NAME_SIZE 16
1078#if defined(RTEMS_SMP)
1089#if defined(RTEMS_SMP)
1092#define _Thread_queue_Heads_size sizeof(Thread_queue_Heads)
1121 } Thread_queue_heads;
1129#define THREAD_INFORMATION_DEFINE_ZERO( name, api, cls ) \
1130Thread_Information name##_Information = { \
1132 _Objects_Build_id( api, cls, 1, 0 ), \
1134 _Objects_Allocate_none, \
1140 CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
1144 OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ), \
1158#define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \
1159static Objects_Control * \
1160name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
1161static RTEMS_SECTION( ".noinit.rtems.content.objects." #name ) \
1162Thread_Configured_control \
1163name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
1164static RTEMS_SECTION( ".noinit.rtems.content.objects." #name ) \
1165Thread_queue_Configured_heads \
1166name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
1167Thread_Information name##_Information = { \
1169 _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
1170 name##_Local_table, \
1171 _Objects_Is_unlimited( max ) ? \
1172 _Thread_Allocate_unlimited : _Objects_Allocate_static, \
1173 _Objects_Is_unlimited( max ) ? \
1174 _Objects_Free_unlimited : _Objects_Free_static, \
1176 _Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
1177 sizeof( Thread_Configured_control ), \
1178 OBJECTS_NO_STRING_NAME, \
1179 CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
1182 &name##_Objects[ 0 ].Control.Object \
1183 OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ) \
1185 &name##_Heads[ 0 ] \
1189#if defined(RTEMS_MULTIPROCESSING)
1196typedef struct Thread_Configured_proxy_control Thread_Configured_proxy_control;
1203extern 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
#define ISR_LOCK_MEMBER(_designator)
Defines an ISR lock member.
Definition: isrlock.h:105
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:1092
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:722
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: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
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:111
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:1081
struct Thread_Configured_control Thread_Configured_control
The configured thread control block.
Definition: thread.h:1070
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:638
Thread_APIs
Definition: thread.h:627
@ THREAD_API_POSIX
Definition: thread.h:631
@ THREAD_API_RTEMS
Definition: thread.h:629
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:169
The freechain control.
Definition: freechain.h:64
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:81
ISR lock control.
Definition: isrlock.h:72
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:708
Thread action.
Definition: thread.h:681
This structure is used to control the CPU budget of a thread.
Definition: thread.h:188
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:201
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:194
This structure contains operations which manage the CPU budget of a thread.
Definition: thread.h:165
Thread control add-on.
Definition: thread.h:991
size_t source_offset
Offset relative to the thread control block begin to an application configuration dependent memory ar...
Definition: thread.h:1003
size_t destination_offset
Offset of the pointer field in Thread_Control referencing an application configuration dependent memo...
Definition: thread.h:997
Data for idle thread entry.
Definition: thread.h:116
Thread entry information.
Definition: thread.h:140
Data for thread entry with one numeric argument and no return value.
Definition: thread.h:123
Data for thread entry with one pointer argument and a pointer return value.
Definition: thread.h:132
Thread life control.
Definition: thread.h:770
uint32_t pending_life_change_requests
The count of pending life change requests.
Definition: thread.h:785
Thread_Action Action
Thread life action used to react upon thread restart and delete requests.
Definition: thread.h:775
Thread_Life_state state
The current thread life state.
Definition: thread.h:780
void * exit_value
The thread exit value.
Definition: thread.h:795
States_Control current_state
Definition: thread.h:567
Objects_Control Object
Definition: thread.h:559
Priority_Node Real_priority
The base priority of this thread in its home scheduler instance.
Definition: thread.h:572
Thread_Timer_information Timer
Definition: thread.h:587
Thread_Wait_information Wait
Definition: thread.h:585
Thread_Scheduler_control Scheduler
Scheduler related control.
Definition: thread.h:582
Thread_queue_Control Join_queue
Definition: thread.h:564
Thread scheduler control.
Definition: thread.h:274
Scheduler_Node * nodes
The scheduler nodes of this thread.
Definition: thread.h:396
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:335
Context_Control Registers
This member contains the context of this thread.
Definition: thread.h:868
Objects_Control Object
Definition: thread.h:814
struct User_extensions_Iterator * last_user_extensions_iterator
LIFO list of user extensions iterators.
Definition: thread.h:967
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
Thread_Keys_information Keys
The POSIX Keys information.
Definition: thread.h:943
States_Control current_state
Definition: thread.h:834
bool is_fp
Definition: thread.h:891
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
void * API_Extensions[THREAD_API_LAST+1]
Definition: thread.h:938
Thread_Timer_information Timer
Definition: thread.h:854
Thread_Life_control Life
Thread life-cycle control.
Definition: thread.h:950
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:903
bool was_created_with_inherited_scheduler
True, if the thread was created with an inherited scheduler (PTHREAD_INHERIT_SCHED),...
Definition: thread.h:897
struct _pthread_cleanup_context * last_cleanup_context
LIFO list of POSIX cleanup contexts.
Definition: thread.h:962
bool is_preemptible
Definition: thread.h:889
Thread_Start_information Start
Definition: thread.h:921
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:916
void * extensions[RTEMS_ZERO_LENGTH_ARRAY]
Variable length array of user extension pointers.
Definition: thread.h:974
bool is_idle
Definition: thread.h:883
struct rtems_user_env_t * user_environment
Pointer to an optional thread-specific POSIX user environment.
Definition: thread.h:957
struct _reent * libc_reent
Definition: thread.h:934
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