RTEMS CPU Kit with SuperCore
Files | Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
Thread Handler

This handler encapsulates functionality related to the management of threads. More...

Collaboration diagram for Thread Handler:

Files

file  iterateoverthreads.c
 Iterates Over All Threads.
 
file  thread.c
 Initialize Thread Handler.
 
file  threadchangepriority.c
 Changes the Priority of a Thread.
 
file  threadclearstate.c
 Clear Thread state.
 
file  threadcreateidle.c
 Create Idle Thread.
 
file  threaddisabledispatch.c
 Disaable Thread Dispatching.
 
file  threaddispatch.c
 Dispatch Thread.
 
file  threaddispatchdisablelevel.c
 Thread Dispatch Disable Functions.
 
file  threadenabledispatch.c
 Enable Dispatching of Threads.
 
file  threadget.c
 Maps Thread IDs to TCB Pointer.
 
file  threadglobalconstruction.c
 Thread Global Construction.
 
file  threadhandler.c
 Thread Handler.
 
file  threadinitialize.c
 Initialize Thread.
 
file  threadloadenv.c
 Initializes Enviroment for A Thread.
 
file  threadrestart.c
 Restart Thread.
 
file  threadsetpriority.c
 Set Thread Priority.
 
file  threadsetstate.c
 Sets States for a Thread.
 
file  threadstackallocate.c
 Stack Allocate Helper.
 
file  threadstackfree.c
 Deallocate Thread Stack.
 
file  threadstart.c
 Initializes Thread and Executes it.
 
file  threadstartmultitasking.c
 Start Thread Multitasking.
 
file  threadtimeout.c
 Thread Wait Timeout.
 
file  threadyield.c
 Thread Yield.
 

Data Structures

struct  rtems_task_variable_t
 Internal structure used to manager per task variables. More...
 
struct  Thread_Start_information
 The following structure contains the information which defines the starting state of a thread. More...
 
union  Thread_Wait_information_Object_argument_type
 Union type to hold a pointer to an immutable or a mutable object. More...
 
struct  Thread_Wait_information
 Information required to manage a thread while it is blocked. More...
 
struct  Thread_Proxy_control
 The following defines the control block used to manage each thread proxy. More...
 
struct  Thread_Action
 Thread action. More...
 
struct  Thread_Action_control
 Control block to manage thread actions. More...
 
struct  Thread_Life_control
 Thread life control. More...
 
struct  Thread_Scheduler_control
 Thread scheduler control. More...
 
struct  Thread_Capture_control
 
struct  Thread_Control
 This structure defines the Thread Control Block (TCB). More...
 
struct  Thread_Control_add_on
 Thread control add-on. More...
 

Macros

#define RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT
 
#define THREAD_API_FIRST   THREAD_API_RTEMS
 This macro defines the first API which has threads. More...
 
#define THREAD_API_LAST   THREAD_API_POSIX
 This macro defines the last API which has threads. More...
 
#define THREAD_STATUS_PROXY_BLOCKING   0x1111111
 The following structure contains the information necessary to manage a thread which it is waiting for a resource.
 
#define THREAD_CHAIN_NODE_TO_THREAD(node)   RTEMS_CONTAINER_OF( node, Thread_Control, Wait.Node.Chain )
 
#define THREAD_RBTREE_NODE_TO_THREAD(node)   RTEMS_CONTAINER_OF( node, Thread_Control, Wait.Node.RBTree )
 
#define _Thread_Lock_set(the_thread, new_lock)   do { } while ( 0 )
 Sets a new thread lock. More...
 
#define _Thread_Lock_restore_default(the_thread)   do { } while ( 0 )
 Restores the default thread lock. More...
 
#define THREAD_WAIT_FLAGS_INITIAL   0x0U
 The initial thread wait flags value set by _Thread_Initialize().
 
#define THREAD_WAIT_STATE_MASK   0xffU
 Mask to get the thread wait state flags.
 
#define THREAD_WAIT_STATE_INTEND_TO_BLOCK   0x1U
 Indicates that the thread begins with the blocking operation. More...
 
#define THREAD_WAIT_STATE_BLOCKED   0x2U
 Indicates that the thread completed the blocking operation.
 
#define THREAD_WAIT_STATE_READY_AGAIN   0x4U
 Indicates that a condition to end the thread wait occurred. More...
 
#define THREAD_WAIT_CLASS_MASK   0xff00U
 Mask to get the thread wait class flags.
 
#define THREAD_WAIT_CLASS_EVENT   0x100U
 Indicates that the thread waits for an event.
 
#define THREAD_WAIT_CLASS_SYSTEM_EVENT   0x200U
 Indicates that the thread waits for a system event.
 
#define THREAD_WAIT_CLASS_OBJECT   0x400U
 Indicates that the thread waits for a object.
 

Typedefs

typedef Timestamp_Control Thread_CPU_usage_t
 
typedef void * Thread
 The following defines the "return type" of a thread. More...
 
typedef CPU_Uint32ptr Thread_Entry_numeric_type
 Type of the numeric argument of a thread entry function with at least one numeric argument. More...
 
typedef Thread(* Thread_Entry) (void)
 This type corresponds to a very simple style thread entry point. More...
 
typedef Thread(* Thread_Entry_numeric) (Thread_Entry_numeric_type)
 This type corresponds to a thread entry point which takes a single unsigned thirty-two bit integer as an argument.
 
typedef Thread(* Thread_Entry_pointer) (void *)
 This type corresponds to a thread entry point which takes a single untyped pointer as an argument.
 
typedef Thread(* Thread_Entry_both_pointer_first) (void *, Thread_Entry_numeric_type)
 This type corresponds to a thread entry point which takes a single untyped pointer and an unsigned thirty-two bit integer as arguments.
 
typedef Thread(* Thread_Entry_both_numeric_first) (Thread_Entry_numeric_type, void *)
 This type corresponds to a thread entry point which takes a single unsigned thirty-two bit integer and an untyped pointer and an as arguments.
 
typedef void(* Thread_CPU_budget_algorithm_callout) (Thread_Control *)
 This defines thes the entry point for the thread specific timeslice budget management algorithm.
 
typedef unsigned int Thread_Wait_flags
 This type is able to contain several flags used to control the wait class and state of a thread. More...
 
typedef struct Thread_Action Thread_Action
 
typedef void(* Thread_Action_handler) (Thread_Control *thread, Thread_Action *action, struct Per_CPU_Control *cpu, ISR_Level level)
 Thread action handler. More...
 
typedef void(* rtems_per_thread_routine) (Thread_Control *)
 This defines the type for a method which operates on a single thread.
 
typedef bool(* Thread_Change_priority_filter) (Thread_Control *the_thread, Priority_Control *new_priority, void *arg)
 Filters a thread priority change. More...
 

Enumerations

enum  Thread_Start_types { THREAD_START_NUMERIC, THREAD_START_POINTER }
 The following defines the ways in which the entry point for a thread can be invoked. More...
 
enum  Thread_CPU_budget_algorithms { THREAD_CPU_BUDGET_ALGORITHM_NONE, THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE, THREAD_CPU_BUDGET_ALGORITHM_CALLOUT }
 The following lists the algorithms used to manage the thread cpu budget. More...
 
enum  Thread_APIs { THREAD_API_RTEMS, THREAD_API_POSIX }
 The following record defines the control block used to manage each thread. More...
 
enum  Thread_Life_state {
  THREAD_LIFE_NORMAL = 0x0, THREAD_LIFE_PROTECTED = 0x1, THREAD_LIFE_RESTARTING = 0x2, THREAD_LIFE_PROTECTED_RESTARTING = 0x3,
  THREAD_LIFE_TERMINATING = 0x4, THREAD_LIFE_PROTECTED_TERMINATING = 0x5, THREAD_LIFE_RESTARTING_TERMINATING = 0x6, THREAD_LIFE_PROTECTED_RESTARTING_TERMINATING = 0x7
}
 Thread life states. More...
 

Functions

void * _Thread_Idle_body (uintptr_t ignored)
 This routine is the body of the system idle thread. More...
 
void rtems_iterate_over_all_threads (rtems_per_thread_routine routine)
 Iterates over all threads. More...
 
RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled (void)
 Indicates if the executing thread is inside a thread dispatch critical section. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level (void)
 Gets thread dispatch disable level. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization (void)
 Thread dispatch initialization. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level (void)
 Increase thread dispatch disable level. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level (void)
 Decrease thread dispatch disable level. More...
 
RTEMS_INLINE_ROUTINE void _Giant_Acquire (Per_CPU_Control *cpu_self)
 
RTEMS_INLINE_ROUTINE void _Giant_Release (Per_CPU_Control *cpu_self)
 
void _Thread_Dispatch (void)
 Performs a thread dispatch if necessary. More...
 
void _Thread_Do_dispatch (Per_CPU_Control *cpu_self, ISR_Level level)
 Performs a thread dispatch on the current processor. More...
 
RTEMS_INLINE_ROUTINE Per_CPU_Control_Thread_Dispatch_disable_critical (const ISR_lock_Context *lock_context)
 Disables thread dispatching inside a critical section (interrupts disabled). More...
 
RTEMS_INLINE_ROUTINE Per_CPU_Control_Thread_Dispatch_disable (void)
 Disables thread dispatching. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable (Per_CPU_Control *cpu_self)
 Enables thread dispatching. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Disable_dispatch (void)
 Disables thread dispatching and acquires the Giant lock.
 
RTEMS_INLINE_ROUTINE void _Thread_Enable_dispatch_body (void)
 
void _Thread_Enable_dispatch (void)
 Enables thread dispatching and releases the Giant lock. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch (void)
 Enables thread dispatching and releases the Giant lock. More...
 
void _Thread_Handler_initialization (void)
 Initialize thread handler. More...
 
void _Thread_Create_idle (void)
 Create idle thread. More...
 
void _Thread_Start_multitasking (void)
 Start thread multitasking. More...
 
size_t _Thread_Stack_Allocate (Thread_Control *the_thread, size_t stack_size)
 Allocate the requested stack space for the thread. More...
 
void _Thread_Stack_Free (Thread_Control *the_thread)
 Deallocate thread stack. More...
 
bool _Thread_Initialize (Objects_Information *information, Thread_Control *the_thread, const struct Scheduler_Control *scheduler, void *stack_area, size_t stack_size, bool is_fp, Priority_Control priority, bool is_preemptible, Thread_CPU_budget_algorithms budget_algorithm, Thread_CPU_budget_algorithm_callout budget_callout, uint32_t isr_level, Objects_Name name)
 Initialize thread. More...
 
bool _Thread_Start (Thread_Control *the_thread, Thread_Start_types the_prototype, void *entry_point, void *pointer_argument, Thread_Entry_numeric_type numeric_argument, Per_CPU_Control *cpu)
 Initializes thread and executes it. More...
 
bool _Thread_Restart (Thread_Control *the_thread, Thread_Control *executing, void *pointer_argument, Thread_Entry_numeric_type numeric_argument)
 
void _Thread_Yield (Thread_Control *executing)
 
bool _Thread_Set_life_protection (bool protect)
 
void _Thread_Life_action_handler (Thread_Control *executing, Thread_Action *action, Per_CPU_Control *cpu, ISR_Level level)
 
void _Thread_Kill_zombies (void)
 Kills all zombie threads in the system. More...
 
void _Thread_Close (Thread_Control *the_thread, Thread_Control *executing)
 Closes the thread. More...
 
States_Control _Thread_Clear_state (Thread_Control *the_thread, States_Control state)
 Clears the specified thread state. More...
 
States_Control _Thread_Set_state (Thread_Control *the_thread, States_Control state)
 Sets the specified thread state. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Ready (Thread_Control *the_thread)
 Clears all thread states. More...
 
void _Thread_Load_environment (Thread_Control *the_thread)
 Initializes enviroment for a thread. More...
 
void _Thread_Handler (void)
 Wrapper function for all threads. More...
 
void * _Thread_Global_construction (void)
 Executes the global constructors and then restarts itself as the first initialization thread. More...
 
void _Thread_Delay_ended (Objects_Id id, void *ignored)
 Ended the delay of a thread. More...
 
RTEMS_INLINE_ROUTINE bool _Thread_Priority_less_than (Priority_Control left, Priority_Control right)
 Returns true if the left thread priority is less than the right thread priority in the intuitive sense of priority and false otherwise.
 
RTEMS_INLINE_ROUTINE Priority_Control _Thread_Priority_highest (Priority_Control left, Priority_Control right)
 Returns the highest priority of the left and right thread priorities in the intuitive sense of priority.
 
void _Thread_Change_priority (Thread_Control *the_thread, Priority_Control new_priority, void *arg, Thread_Change_priority_filter filter, bool prepend_it)
 Changes the priority of a thread if allowed by the filter function. More...
 
void _Thread_Raise_priority (Thread_Control *the_thread, Priority_Control new_priority)
 Raises the priority of a thread. More...
 
void _Thread_Restore_priority (Thread_Control *the_thread)
 Sets the current to the real priority of a thread. More...
 
void _Thread_Set_priority (Thread_Control *the_thread, Priority_Control new_priority, Priority_Control *old_priority, bool prepend_it)
 Sets the priority of a thread. More...
 
Thread_Control_Thread_Get (Objects_Id id, Objects_Locations *location)
 Maps thread Id to a TCB pointer. More...
 
Thread_Control_Thread_Get_interrupt_disable (Objects_Id id, Objects_Locations *location, ISR_lock_Context *lock_context)
 Gets a thread by its identifier. More...
 
RTEMS_INLINE_ROUTINE Per_CPU_Control_Thread_Get_CPU (const Thread_Control *thread)
 
RTEMS_INLINE_ROUTINE void _Thread_Set_CPU (Thread_Control *thread, Per_CPU_Control *cpu)
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_executing (const Thread_Control *the_thread)
 This function returns true if the_thread is the currently executing thread, and false otherwise.
 
RTEMS_INLINE_ROUTINE bool _Thread_Get_time_of_last_context_switch (Thread_Control *the_thread, Timestamp_Control *time_of_context_switch)
 Returns true and sets time_of_context_switch to the time of the last context switch when the thread is currently executing in the system, otherwise false.
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_heir (const Thread_Control *the_thread)
 This function returns true if the_thread is the heir thread, and false otherwise.
 
RTEMS_INLINE_ROUTINE void _Thread_Unblock (Thread_Control *the_thread)
 This routine clears any blocking state for the_thread. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Restart_self (Thread_Control *executing)
 This routine resets the current context of the calling thread to that of its initial state.
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_allocated_fp (const Thread_Control *the_thread)
 This function returns true if the floating point context of the_thread is currently loaded in the floating point unit, and false otherwise.
 
RTEMS_INLINE_ROUTINE void _Thread_Save_fp (Thread_Control *executing)
 
RTEMS_INLINE_ROUTINE void _Thread_Restore_fp (Thread_Control *executing)
 
RTEMS_INLINE_ROUTINE void _Thread_Deallocate_fp (void)
 This routine is invoked when the currently loaded floating point context is now longer associated with an active thread.
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_context_switch_necessary (void)
 This function returns true if dispatching is disabled, and false otherwise.
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_null (const Thread_Control *the_thread)
 This function returns true if the_thread is NULL and false otherwise.
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_proxy_blocking (uint32_t code)
 Is proxy blocking. More...
 
RTEMS_INLINE_ROUTINE uint32_t _Thread_Get_maximum_internal_threads (void)
 
RTEMS_INLINE_ROUTINE Thread_Control_Thread_Internal_allocate (void)
 
RTEMS_INLINE_ROUTINE Thread_Control_Thread_Get_heir_and_make_it_executing (Per_CPU_Control *cpu_self)
 Gets the heir of the processor and makes it executing. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Update_cpu_time_used (Thread_Control *executing, Timestamp_Control *time_of_last_context_switch)
 
RTEMS_INLINE_ROUTINE void _Thread_Action_control_initialize (Thread_Action_control *action_control)
 
RTEMS_INLINE_ROUTINE void _Thread_Action_initialize (Thread_Action *action, Thread_Action_handler handler)
 
RTEMS_INLINE_ROUTINE Per_CPU_Control_Thread_Action_ISR_disable_and_acquire_for_executing (ISR_Level *level)
 
RTEMS_INLINE_ROUTINE Per_CPU_Control_Thread_Action_ISR_disable_and_acquire (Thread_Control *thread, ISR_Level *level)
 
RTEMS_INLINE_ROUTINE void _Thread_Action_release_and_ISR_enable (Per_CPU_Control *cpu, ISR_Level level)
 
RTEMS_INLINE_ROUTINE void _Thread_Add_post_switch_action (Thread_Control *thread, Thread_Action *action)
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_restarting (Thread_Life_state life_state)
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_terminating (Thread_Life_state life_state)
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_protected (Thread_Life_state life_state)
 
RTEMS_INLINE_ROUTINE bool _Thread_Is_life_changing (Thread_Life_state life_state)
 
RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources (const Thread_Control *the_thread)
 Returns true if the thread owns resources, and false otherwise. More...
 
RTEMS_INLINE_ROUTINE Thread_Control_Thread_Lock_acquire_default_for_executing (ISR_lock_Context *lock_context)
 Acquires the default thread lock and returns the executing thread. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_acquire_default_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the default thread lock inside a critical section (interrupts disabled). More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_acquire_default (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the default thread lock. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_release_critical (ISR_lock_Control *lock, ISR_lock_Context *lock_context)
 Releases the thread lock inside a critical section (interrupts disabled). More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_release (ISR_lock_Control *lock, ISR_lock_Context *lock_context)
 Releases the thread lock. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_release_default_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the default thread lock inside a critical section (interrupts disabled). More...
 
RTEMS_INLINE_ROUTINE void _Thread_Lock_release_default (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the default thread lock. More...
 
RTEMS_INLINE_ROUTINE ISR_lock_Control_Thread_Lock_acquire (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the thread lock. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Wait_flags_set (Thread_Control *the_thread, Thread_Wait_flags flags)
 
RTEMS_INLINE_ROUTINE Thread_Wait_flags _Thread_Wait_flags_get (const Thread_Control *the_thread)
 
RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_critical (Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
 Tries to change the thread wait flags inside a critical section (interrupts disabled). More...
 
RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change (Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
 Tries to change the thread wait flags. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Wait_set_queue (Thread_Control *the_thread, Thread_queue_Control *new_queue)
 Sets the thread queue. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Wait_set_operations (Thread_Control *the_thread, const Thread_queue_Operations *new_operations)
 Sets the thread queue operations. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default_operations (Thread_Control *the_thread)
 Restores the default thread queue operations. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Wait_set_timeout_code (Thread_Control *the_thread, uint32_t timeout_code)
 Sets the thread wait timeout code. More...
 
void _Thread_Timeout (Objects_Id id, void *arg)
 General purpose thread wait timeout. More...
 
RTEMS_INLINE_ROUTINE void _Thread_Debug_set_real_processor (Thread_Control *the_thread, Per_CPU_Control *cpu)
 
RTEMS_INLINE_ROUTINE struct _reent ** _Thread_Get_libc_reent (void)
 This routine returns the C library re-enterant pointer.
 
RTEMS_INLINE_ROUTINE void _Thread_Set_libc_reent (struct _reent **libc_reent)
 This routine set the C library re-enterant pointer.
 

Variables

const Thread_Control_add_on _Thread_Control_add_ons []
 Thread control add-ons. More...
 
const size_t _Thread_Control_add_on_count
 Thread control add-on count. More...
 
const size_t _Thread_Control_size
 Size of the thread control block of a particular application. More...
 
SCORE_EXTERN void * rtems_ada_self
 Self for the GNU Ada Run-Time.
 
SCORE_EXTERN Objects_Information _Thread_Internal_information
 The following defines the information control block used to manage this class of objects.
 
SCORE_EXTERN Thread_Control_Thread_Allocated_fp
 The following points to the thread whose floating point context is currently loaded.
 
SCORE_EXTERN struct _reent ** _Thread_libc_reent
 The C library re-enter-rant global pointer. More...
 

Detailed Description

This handler encapsulates functionality related to the management of threads.

This includes the creation, deletion, and scheduling of threads.

The following variables are maintained as part of the per cpu data structure.

Macro Definition Documentation

◆ _Thread_Lock_restore_default

#define _Thread_Lock_restore_default (   the_thread)    do { } while ( 0 )

Restores the default thread lock.

The caller must be the owner of the current thread lock.

Parameters
[in]the_threadThe thread.

Referenced by _Thread_queue_Extract_locked().

◆ _Thread_Lock_set

#define _Thread_Lock_set (   the_thread,
  new_lock 
)    do { } while ( 0 )

Sets a new thread lock.

The caller must not be the owner of the default thread lock. The caller must be the owner of the new lock.

Parameters
[in]the_threadThe thread.
[in]new_lockThe new thread lock.

◆ THREAD_API_FIRST

#define THREAD_API_FIRST   THREAD_API_RTEMS

This macro defines the first API which has threads.

◆ THREAD_API_LAST

#define THREAD_API_LAST   THREAD_API_POSIX

This macro defines the last API which has threads.

◆ THREAD_WAIT_STATE_INTEND_TO_BLOCK

#define THREAD_WAIT_STATE_INTEND_TO_BLOCK   0x1U

Indicates that the thread begins with the blocking operation.

A blocking operation consists of an optional watchdog initialization and the setting of the appropriate thread blocking state with the corresponding scheduler block operation.

◆ THREAD_WAIT_STATE_READY_AGAIN

#define THREAD_WAIT_STATE_READY_AGAIN   0x4U

Indicates that a condition to end the thread wait occurred.

This could be a timeout, a signal, an event or a resource availability.

Typedef Documentation

◆ Thread

typedef void* Thread

The following defines the "return type" of a thread.

Note
This cannot always be right. Some APIs have void tasks/threads, others return pointers, others may return a numeric value. Hopefully a pointer is always at least as big as an uint32_t . :)

◆ Thread_Action_handler

typedef void( * Thread_Action_handler) (Thread_Control *thread, Thread_Action *action, struct Per_CPU_Control *cpu, ISR_Level level)

Thread action handler.

The thread action handler will be called with interrupts disabled and the thread action lock acquired. The handler must release the thread action lock with _Thread_Action_release_and_ISR_enable(). So the thread action lock can be used to protect private data fields of the particular action.

Since the action is passed to the handler private data fields can be added below the common thread action fields.

Parameters
[in]threadThe thread performing the action.
[in]actionThe thread action.
[in]cpuThe processor of the thread.
[in]levelThe ISR level for _Thread_Action_release_and_ISR_enable().

◆ Thread_Change_priority_filter

typedef bool( * Thread_Change_priority_filter) (Thread_Control *the_thread, Priority_Control *new_priority, void *arg)

Filters a thread priority change.

Called by _Thread_Change_priority() under the protection of the thread lock.

Parameters
[in]the_threadThe thread.
[in,out]new_priorityThe new priority of the thread. The filter may alter this value.
[in]argThe argument passed to _Thread_Change_priority().
Return values
trueChange the current priority.
falseOtherwise.

◆ Thread_Entry

typedef Thread( * Thread_Entry) (void)

This type corresponds to a very simple style thread entry point.

◆ Thread_Entry_numeric_type

Type of the numeric argument of a thread entry function with at least one numeric argument.

This numeric argument type designates an unsigned integer type with the property that any valid pointer to void can be converted to this type and then converted back to a pointer to void. The result will compare equal to the original pointer.

◆ Thread_Wait_flags

typedef unsigned int Thread_Wait_flags

This type is able to contain several flags used to control the wait class and state of a thread.

The mutually exclusive wait class flags are

The mutually exclusive wait state flags are

Enumeration Type Documentation

◆ Thread_APIs

The following record defines the control block used to manage each thread.

Note
It is critical that proxies and threads have identical memory images for the shared part.
Enumerator
THREAD_API_RTEMS 

This value is for the Classic RTEMS API.

THREAD_API_POSIX 

This value is for the POSIX API.

◆ Thread_CPU_budget_algorithms

The following lists the algorithms used to manage the thread cpu budget.

Reset Timeslice: At each context switch, reset the time quantum. Exhaust Timeslice: Only reset the quantum once it is consumed. Callout: Execute routine when budget is consumed.

◆ Thread_Life_state

Thread life states.

The thread life states are orthogonal to the thread states used for synchronization primitives and blocking operations. They reflect the state changes triggered with thread restart and delete requests.

◆ Thread_Start_types

The following defines the ways in which the entry point for a thread can be invoked.

Basically, it can be passed any combination/permutation of a pointer and an uint32_t value.

Note
For now, we are ignoring the return type.

Function Documentation

◆ _Thread_Change_priority()

void _Thread_Change_priority ( Thread_Control the_thread,
Priority_Control  new_priority,
void *  arg,
Thread_Change_priority_filter  filter,
bool  prepend_it 
)

Changes the priority of a thread if allowed by the filter function.

It changes current priority of the thread to the new priority in case the filter function returns true. In this case the scheduler is notified of the priority change as well.

Parameters
[in]the_threadThe thread.
[in]new_priorityThe new priority of the thread.
[in]argThe argument for the filter function.
[in]filterThe filter function to determine if a priority change is allowed and optionally perform other actions under the protection of the thread lock simultaneously with the update of the current priority.
[in]prepend_itIn case this is true, then the thread is prepended to its priority group in its scheduler instance, otherwise it is appended.

Referenced by _POSIX_Threads_Sporadic_budget_callout(), _POSIX_Threads_Sporadic_budget_TSR(), _Thread_Raise_priority(), _Thread_Restore_priority(), and _Thread_Set_priority().

◆ _Thread_Clear_state()

States_Control _Thread_Clear_state ( Thread_Control the_thread,
States_Control  state 
)

Clears the specified thread state.

In case the previous state is a non-ready state and the next state is the ready state, then the thread is unblocked by the scheduler.

Parameters
[in]the_threadThe thread.
[in]stateThe state to clear. It must not be zero.
Returns
The previous state.

Referenced by _Thread_Ready(), and _Thread_Unblock().

◆ _Thread_Close()

void _Thread_Close ( Thread_Control the_thread,
Thread_Control executing 
)

Closes the thread.

Closes the thread object and starts the thread termination sequence. In case the executing thread is not terminated, then this function waits until the terminating thread reached the zombie state.

References _Assert.

◆ _Thread_Create_idle()

void _Thread_Create_idle ( void  )

Create idle thread.

This routine creates the idle thread.

Warning
No thread should be created before this one.

◆ _Thread_Delay_ended()

void _Thread_Delay_ended ( Objects_Id  id,
void *  ignored 
)

Ended the delay of a thread.

This routine is invoked when a thread must be unblocked at the end of a time based delay (i.e. wake after or wake when). It is called by the watchdog handler.

Parameters
[in]idis the thread id
[in]ignoredis not used

Referenced by _Thread_Ready().

◆ _Thread_Dispatch()

void _Thread_Dispatch ( void  )

Performs a thread dispatch if necessary.

This routine is responsible for transferring control of the processor from the executing thread to the heir thread. Once the heir is running an attempt is made to run the pending post-switch thread actions.

As part of this process, it is responsible for the following actions

  • update timing information of the executing thread,
  • save the context of the executing thread,
  • invokation of the thread switch user extensions,
  • restore the context of the heir thread, and
  • run of pending post-switch thread actions of the resulting executing thread.

On entry the thread dispatch level must be equal to zero.

Referenced by _Watchdog_Tick().

◆ _Thread_Dispatch_decrement_disable_level()

RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_decrement_disable_level ( void  )

Decrease thread dispatch disable level.

This routine decrements the thread dispatch level.

Referenced by _Thread_Unnest_dispatch().

◆ _Thread_Dispatch_disable()

RTEMS_INLINE_ROUTINE Per_CPU_Control* _Thread_Dispatch_disable ( void  )

Disables thread dispatching.

This function does not acquire the Giant lock.

Returns
The current processor.

References _ISR_lock_ISR_disable, _ISR_lock_ISR_enable, and _Thread_Dispatch_disable_critical().

Referenced by _CORE_mutex_Initialize(), and rtems_task_wake_after().

◆ _Thread_Dispatch_disable_critical()

RTEMS_INLINE_ROUTINE Per_CPU_Control* _Thread_Dispatch_disable_critical ( const ISR_lock_Context lock_context)

Disables thread dispatching inside a critical section (interrupts disabled).

This function does not acquire the Giant lock.

Parameters
[in]lock_contextThe lock context of the corresponding _ISR_lock_ISR_disable() that started the critical section.
Returns
The current processor.

Referenced by _Thread_Dispatch_disable().

◆ _Thread_Dispatch_enable()

RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable ( Per_CPU_Control cpu_self)

Enables thread dispatching.

May perfrom a thread dispatch if necessary as a side-effect.

This function does not release the Giant lock.

Parameters
[in]cpu_selfThe current processor.

References Per_CPU_Control::thread_dispatch_disable_level.

Referenced by _CORE_mutex_Initialize().

◆ _Thread_Dispatch_get_disable_level()

RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_get_disable_level ( void  )

Gets thread dispatch disable level.

Returns
The value of the thread dispatch level.

◆ _Thread_Dispatch_increment_disable_level()

RTEMS_INLINE_ROUTINE uint32_t _Thread_Dispatch_increment_disable_level ( void  )

Increase thread dispatch disable level.

This rountine increments the thread dispatch level

Referenced by _Thread_Disable_dispatch().

◆ _Thread_Dispatch_initialization()

RTEMS_INLINE_ROUTINE void _Thread_Dispatch_initialization ( void  )

Thread dispatch initialization.

This routine initializes the thread dispatching subsystem.

◆ _Thread_Dispatch_is_enabled()

RTEMS_INLINE_ROUTINE bool _Thread_Dispatch_is_enabled ( void  )

Indicates if the executing thread is inside a thread dispatch critical section.

Return values
trueThread dispatching is enabled.
falseThe executing thread is inside a thread dispatch critical section and dispatching is not allowed.

Referenced by _Watchdog_Tick().

◆ _Thread_Do_dispatch()

void _Thread_Do_dispatch ( Per_CPU_Control cpu_self,
ISR_Level  level 
)

Performs a thread dispatch on the current processor.

On entry the thread dispatch disable level must be equal to one and interrupts must be disabled.

This function assumes that a thread dispatch is necessary.

Parameters
[in]cpu_selfThe current processor.
[in]levelThe previous interrupt level.
See also
_Thread_Dispatch().

References _Assert, _Thread_Get_heir_and_make_it_executing(), Thread_Control::budget_algorithm, Per_CPU_Control::executing, rtems_ada_self, and Per_CPU_Control::thread_dispatch_disable_level.

◆ _Thread_Enable_dispatch()

void _Thread_Enable_dispatch ( void  )

Enables thread dispatching and releases the Giant lock.

May perfrom a thread dispatch if necessary as a side-effect.

Referenced by _Objects_Put(), _POSIX_Threads_cancel_run(), rtems_rate_monotonic_reset_all_statistics(), and rtems_signal_catch().

◆ _Thread_Get()

Thread_Control* _Thread_Get ( Objects_Id  id,
Objects_Locations location 
)

Maps thread Id to a TCB pointer.

This function maps thread IDs to thread control blocks. If ID corresponds to a local thread, then it returns the_thread control pointer which maps to ID and location is set to OBJECTS_LOCAL. If the thread ID is global and resides on a remote node, then location is set to OBJECTS_REMOTE, and the_thread is undefined. Otherwise, location is set to OBJECTS_ERROR and the_thread is undefined.

Parameters
[in]idis the id of the thread.
[in]locationis the location of the block.
Note
The performance of many RTEMS services depends upon the quick execution of the "good object" path in this routine. If there is a possibility of saving a few cycles off the execution time, this routine is worth further optimization attention.

References _Objects_Are_ids_equal(), _Thread_Disable_dispatch(), and OBJECTS_ID_OF_SELF.

Referenced by _MPCI_Process_response(), pthread_detach(), rtems_signal_send(), rtems_task_get_note(), rtems_task_get_scheduler(), rtems_task_is_suspended(), rtems_task_restart(), rtems_task_resume(), rtems_task_set_note(), rtems_task_set_priority(), rtems_task_start(), rtems_task_suspend(), rtems_task_variable_add(), rtems_task_variable_delete(), and rtems_task_variable_get().

◆ _Thread_Get_heir_and_make_it_executing()

RTEMS_INLINE_ROUTINE Thread_Control* _Thread_Get_heir_and_make_it_executing ( Per_CPU_Control cpu_self)

Gets the heir of the processor and makes it executing.

The thread dispatch necessary indicator is cleared as a side-effect.

Returns
The heir thread.
See also
_Thread_Dispatch(), _Thread_Start_multitasking() and _Thread_Dispatch_update_heir().

References Per_CPU_Control::dispatch_necessary.

Referenced by _Thread_Do_dispatch().

◆ _Thread_Get_interrupt_disable()

Thread_Control* _Thread_Get_interrupt_disable ( Objects_Id  id,
Objects_Locations location,
ISR_lock_Context lock_context 
)

Gets a thread by its identifier.

See also
_Objects_Get_isr_disable().

References _Objects_Are_ids_equal(), and OBJECTS_ID_OF_SELF.

Referenced by rtems_event_send(), and rtems_event_system_send().

◆ _Thread_Global_construction()

void* _Thread_Global_construction ( void  )

Executes the global constructors and then restarts itself as the first initialization thread.

The first initialization thread is the first RTEMS initialization task or the first POSIX initialization thread in case no RTEMS initialization tasks are present.

References _Thread_Disable_dispatch(), Configuration_POSIX_API, Configuration_RTEMS_API, rtems_initialization_tasks_table::entry_point, rtems_api_configuration_table::number_of_initialization_tasks, and rtems_api_configuration_table::User_initialization_tasks_table.

Referenced by _Thread_Ready().

◆ _Thread_Handler()

void _Thread_Handler ( void  )

Wrapper function for all threads.

This routine is the wrapper function for all threads. It is the starting point for all threads. The user provided thread entry point is invoked by this routine. Operations which must be performed immediately before and after the user's thread executes are found here.

Note
On entry, it is assumed all interrupts are blocked and that this routine needs to set the initial isr level. This may or may not actually be needed by the context switch routine and as a result interrupts may already be at there proper level. Either way, setting the initial isr level properly here is safe.

Referenced by _Thread_Ready().

◆ _Thread_Handler_initialization()

void _Thread_Handler_initialization ( void  )

Initialize thread handler.

This routine performs the initialization necessary for this handler.

◆ _Thread_Idle_body()

void* _Thread_Idle_body ( uintptr_t  ignored)

This routine is the body of the system idle thread.

NOTE: This routine is actually instantiated by confdefs.h when needed.

◆ _Thread_Initialize()

bool _Thread_Initialize ( Objects_Information information,
Thread_Control the_thread,
const struct Scheduler_Control scheduler,
void *  stack_area,
size_t  stack_size,
bool  is_fp,
Priority_Control  priority,
bool  is_preemptible,
Thread_CPU_budget_algorithms  budget_algorithm,
Thread_CPU_budget_algorithm_callout  budget_callout,
uint32_t  isr_level,
Objects_Name  name 
)

Initialize thread.

This routine initializes the specified the thread. It allocates all memory associated with this thread. It completes by adding the thread to the local object table so operations on this thread id are allowed.

Note
If stack_area is NULL, it is allocated from the workspace.
If the stack is allocated from the workspace, then it is guaranteed to be of at least minimum size.

◆ _Thread_Is_proxy_blocking()

RTEMS_INLINE_ROUTINE bool _Thread_Is_proxy_blocking ( uint32_t  code)

Is proxy blocking.

status which indicates that a proxy is blocking, and false otherwise.

References RTEMS_INLINE_ROUTINE, and THREAD_STATUS_PROXY_BLOCKING.

◆ _Thread_Kill_zombies()

void _Thread_Kill_zombies ( void  )

Kills all zombie threads in the system.

Threads change into the zombie state as the last step in the thread termination sequence right before a context switch to the heir thread is initiated. Since the thread stack is still in use during this phase we have to postpone the thread stack reclamation until this point. On SMP configurations we may have to busy wait for context switch completion here.

◆ _Thread_Load_environment()

void _Thread_Load_environment ( Thread_Control the_thread)

Initializes enviroment for a thread.

This routine initializes the context of the_thread to its appropriate starting state.

Parameters
[in]the_threadis the pointer to the thread control block.

References _Context_Initialize_fp, Thread_Start_information::budget_algorithm, Thread_Control::budget_algorithm, Thread_Start_information::budget_callout, Thread_Control::budget_callout, Thread_Start_information::fp_context, Thread_Control::fp_context, Thread_Start_information::is_preemptible, Thread_Control::is_preemptible, and Thread_Control::Start.

Referenced by _Thread_Ready(), and _Thread_Start().

◆ _Thread_Lock_acquire()

RTEMS_INLINE_ROUTINE ISR_lock_Control* _Thread_Lock_acquire ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Acquires the thread lock.

Parameters
[in]the_threadThe thread.
[in]lock_contextThe lock context for _Thread_Lock_release().
Returns
The lock required by _Thread_Lock_release().

◆ _Thread_Lock_acquire_default()

RTEMS_INLINE_ROUTINE void _Thread_Lock_acquire_default ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Acquires the default thread lock.

Parameters
[in]the_threadThe thread.
[in]lock_contextThe lock context used for the corresponding lock release.
See also
_Thread_Lock_release_default().

References _ISR_lock_ISR_disable_and_acquire.

◆ _Thread_Lock_acquire_default_critical()

RTEMS_INLINE_ROUTINE void _Thread_Lock_acquire_default_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Acquires the default thread lock inside a critical section (interrupts disabled).

Parameters
[in]the_threadThe thread.
[in]lock_contextThe lock context used for the corresponding lock release.
See also
_Thread_Lock_release_default().

References _Assert, _ISR_Get_level, and _ISR_lock_Acquire.

◆ _Thread_Lock_acquire_default_for_executing()

RTEMS_INLINE_ROUTINE Thread_Control* _Thread_Lock_acquire_default_for_executing ( ISR_lock_Context lock_context)

Acquires the default thread lock and returns the executing thread.

Parameters
[in]lock_contextThe lock context used for the corresponding lock release.
Returns
The executing thread.
See also
_Thread_Lock_release_default().

References _ISR_lock_ISR_disable.

Referenced by rtems_event_receive(), and rtems_event_system_receive().

◆ _Thread_Lock_release()

RTEMS_INLINE_ROUTINE void _Thread_Lock_release ( ISR_lock_Control lock,
ISR_lock_Context lock_context 
)

Releases the thread lock.

Parameters
[in]lockThe lock returned by _Thread_Lock_acquire().
[in]lock_contextThe lock context used for _Thread_Lock_acquire().

◆ _Thread_Lock_release_critical()

RTEMS_INLINE_ROUTINE void _Thread_Lock_release_critical ( ISR_lock_Control lock,
ISR_lock_Context lock_context 
)

Releases the thread lock inside a critical section (interrupts disabled).

The previous interrupt status is not restored.

Parameters
[in]lockThe lock.
[in]lock_contextThe lock context used for the corresponding lock acquire.

Referenced by _Thread_Lock_release_default_critical().

◆ _Thread_Lock_release_default()

RTEMS_INLINE_ROUTINE void _Thread_Lock_release_default ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Releases the default thread lock.

Parameters
[in]the_threadThe thread.
[in]lock_contextThe lock context used for the corresponding lock acquire.

References _ISR_lock_ISR_enable, and _Thread_Lock_release_default_critical().

◆ _Thread_Lock_release_default_critical()

RTEMS_INLINE_ROUTINE void _Thread_Lock_release_default_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)

Releases the default thread lock inside a critical section (interrupts disabled).

The previous interrupt status is not restored.

Parameters
[in]the_threadThe thread.
[in]lock_contextThe lock context used for the corresponding lock acquire.

References _Thread_Lock_release_critical().

Referenced by _Thread_Lock_release_default().

◆ _Thread_Owns_resources()

RTEMS_INLINE_ROUTINE bool _Thread_Owns_resources ( const Thread_Control the_thread)

Returns true if the thread owns resources, and false otherwise.

Resources are accounted with the Thread_Control::resource_count resource counter. This counter is used by semaphore objects for example.

In addition to the resource counter there is a resource dependency tree available on SMP configurations. In case this tree is non-empty, then the thread owns resources.

Parameters
[in]the_threadThe thread.

References Thread_Control::resource_count.

◆ _Thread_Raise_priority()

void _Thread_Raise_priority ( Thread_Control the_thread,
Priority_Control  new_priority 
)

Raises the priority of a thread.

It changes the current priority of the thread to the new priority if the new priority is higher than the current priority. In this case the thread is appended to its new priority group in its scheduler instance.

Parameters
[in]the_threadThe thread.
[in]new_priorityThe new priority of the thread.
See also
_Thread_Change_priority().

References _Thread_Change_priority().

Referenced by _CORE_mutex_Initialize().

◆ _Thread_Ready()

RTEMS_INLINE_ROUTINE void _Thread_Ready ( Thread_Control the_thread)

Clears all thread states.

In case the previous state is a non-ready state, then the thread is unblocked by the scheduler.

Parameters
[in]the_threadThe thread.

References _Thread_Clear_state(), _Thread_Delay_ended(), _Thread_Global_construction(), _Thread_Handler(), _Thread_Load_environment(), and STATES_ALL_SET.

Referenced by _Thread_Start().

◆ _Thread_Restore_priority()

void _Thread_Restore_priority ( Thread_Control the_thread)

Sets the current to the real priority of a thread.

Sets the priority restore hint to false.

References _Thread_Change_priority().

◆ _Thread_Set_priority()

void _Thread_Set_priority ( Thread_Control the_thread,
Priority_Control  new_priority,
Priority_Control old_priority,
bool  prepend_it 
)

Sets the priority of a thread.

It sets the real priority of the thread. In addition it changes the current priority of the thread if the new priority is higher than the current priority or the thread owns no resources.

Parameters
[in]the_threadThe thread.
[in]new_priorityThe new priority of the thread.
[out]old_priorityThe old real priority of the thread. This pointer must not be NULL.
[in]prepend_itIn case this is true, then the thread is prepended to its priority group in its scheduler instance, otherwise it is appended.
See also
_Thread_Change_priority().

References _Thread_Change_priority().

Referenced by _Scheduler_EDF_Release_job().

◆ _Thread_Set_state()

States_Control _Thread_Set_state ( Thread_Control the_thread,
States_Control  state 
)

Sets the specified thread state.

In case the previous state is the ready state, then the thread is blocked by the scheduler.

Parameters
[in]the_threadThe thread.
[in]stateThe state to set. It must not be zero.
Returns
The previous state.

◆ _Thread_Stack_Allocate()

size_t _Thread_Stack_Allocate ( Thread_Control the_thread,
size_t  stack_size 
)

Allocate the requested stack space for the thread.

Allocate the requested stack space for the thread. Set the Start.stack field to the address of the stack.

Parameters
[in]the_threadis the thread where the stack space is requested
[in]stack_sizeis the stack space is requested
Return values
actualsize allocated after any adjustment
zeroif the allocation failed

◆ _Thread_Stack_Free()

void _Thread_Stack_Free ( Thread_Control the_thread)

Deallocate thread stack.

Deallocate the Thread's stack.

◆ _Thread_Start()

bool _Thread_Start ( Thread_Control the_thread,
Thread_Start_types  the_prototype,
void *  entry_point,
void *  pointer_argument,
Thread_Entry_numeric_type  numeric_argument,
Per_CPU_Control cpu 
)

Initializes thread and executes it.

This routine initializes the executable information for a thread and makes it ready to execute. After this routine executes, the thread competes with all other threads for CPU time.

Parameters
the_threadis the thread to be initialized
the_prototype
entry_point
pointer_argument
numeric_argument
[in,out]cpuThe processor if used to start an idle thread during system initialization. Must be set to NULL to start a normal thread.

References _States_Is_dormant(), _Thread_Load_environment(), _Thread_Ready(), Thread_Control::current_state, Thread_Start_information::entry_point, Thread_Start_information::numeric_argument, Thread_Start_information::pointer_argument, Thread_Start_information::prototype, and Thread_Control::Start.

◆ _Thread_Start_multitasking()

void _Thread_Start_multitasking ( void  )

Start thread multitasking.

This routine initiates multitasking. It is invoked only as part of initialization and its invocation is the last act of the non-multitasking part of the system initialization.

◆ _Thread_Timeout()

void _Thread_Timeout ( Objects_Id  id,
void *  arg 
)

General purpose thread wait timeout.

Parameters
[in]idUnused.
[in]argThe thread.

Referenced by _Thread_Wait_set_timeout_code().

◆ _Thread_Unblock()

RTEMS_INLINE_ROUTINE void _Thread_Unblock ( Thread_Control the_thread)

This routine clears any blocking state for the_thread.

It performs any necessary scheduling operations including the selection of a new heir thread.

References _Thread_Clear_state(), and STATES_BLOCKED.

◆ _Thread_Unnest_dispatch()

RTEMS_INLINE_ROUTINE void _Thread_Unnest_dispatch ( void  )

Enables thread dispatching and releases the Giant lock.

Warning
A thread dispatch is not performed as a side-effect. Use this function with

References _Thread_Dispatch_decrement_disable_level(), and RTEMS_COMPILER_MEMORY_BARRIER.

Referenced by _Objects_Put_without_thread_dispatch(), and _POSIX_Thread_Evaluate_cancellation_and_enable_dispatch().

◆ _Thread_Wait_flags_try_change()

RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change ( Thread_Control the_thread,
Thread_Wait_flags  expected_flags,
Thread_Wait_flags  desired_flags 
)

Tries to change the thread wait flags.

See also
_Thread_Wait_flags_try_change_critical().

◆ _Thread_Wait_flags_try_change_critical()

RTEMS_INLINE_ROUTINE bool _Thread_Wait_flags_try_change_critical ( Thread_Control the_thread,
Thread_Wait_flags  expected_flags,
Thread_Wait_flags  desired_flags 
)

Tries to change the thread wait flags inside a critical section (interrupts disabled).

In case the wait flags are equal to the expected wait flags, then the wait flags are set to the desired wait flags.

Parameters
[in]the_threadThe thread.
[in]expected_flagsThe expected wait flags.
[in]desired_flagsThe desired wait flags.
Return values
trueThe wait flags were equal to the expected wait flags.
falseOtherwise.

◆ _Thread_Wait_restore_default_operations()

RTEMS_INLINE_ROUTINE void _Thread_Wait_restore_default_operations ( Thread_Control the_thread)

Restores the default thread queue operations.

The caller must be the owner of the thread lock.

Parameters
[in]the_threadThe thread.
See also
_Thread_Wait_set_operations().

References Thread_Wait_information::operations, and Thread_Control::Wait.

Referenced by _Thread_queue_Extract_locked().

◆ _Thread_Wait_set_operations()

RTEMS_INLINE_ROUTINE void _Thread_Wait_set_operations ( Thread_Control the_thread,
const Thread_queue_Operations new_operations 
)

Sets the thread queue operations.

The caller must be the owner of the thread lock.

Parameters
[in]the_threadThe thread.
[in]new_operationsThe new queue operations.
See also
_Thread_Lock_set() and _Thread_Wait_restore_default_operations().

References Thread_Wait_information::operations, and Thread_Control::Wait.

◆ _Thread_Wait_set_queue()

RTEMS_INLINE_ROUTINE void _Thread_Wait_set_queue ( Thread_Control the_thread,
Thread_queue_Control new_queue 
)

Sets the thread queue.

The caller must be the owner of the thread lock.

Parameters
[in]the_threadThe thread.
[in]new_queueThe new queue.
See also
_Thread_Lock_set().

References Thread_Wait_information::queue, and Thread_Control::Wait.

Referenced by _Thread_queue_Extract_locked().

◆ _Thread_Wait_set_timeout_code()

RTEMS_INLINE_ROUTINE void _Thread_Wait_set_timeout_code ( Thread_Control the_thread,
uint32_t  timeout_code 
)

Sets the thread wait timeout code.

Parameters
[in]the_threadThe thread.
[in]timeout_codeThe new thread wait timeout code.

References _Thread_Timeout(), RTEMS_INLINE_ROUTINE, Thread_Wait_information::timeout_code, and Thread_Control::Wait.

◆ rtems_iterate_over_all_threads()

void rtems_iterate_over_all_threads ( rtems_per_thread_routine  routine)

Iterates over all threads.

This routine iterates over all threads regardless of API and invokes the specified routine.

References _Objects_Information_table, Objects_Information::local_table, Objects_Information::maximum, and OBJECTS_APIS_LAST.

Variable Documentation

◆ _Thread_Control_add_on_count

const size_t _Thread_Control_add_on_count

Thread control add-on count.

Count of entries in _Thread_Control_add_ons.

This value is provided via <rtems/confdefs.h>.

◆ _Thread_Control_add_ons

const Thread_Control_add_on _Thread_Control_add_ons[]

Thread control add-ons.

The thread control block contains fields that point to application configuration dependent memory areas, like the scheduler information, the API control blocks, the user extension context table, the RTEMS notepads and the Newlib re-entrancy support. Account for these areas in the configuration and avoid extra workspace allocations for these areas.

This array is provided via <rtems/confdefs.h>.

See also
_Thread_Control_add_on_count and _Thread_Control_size.

◆ _Thread_Control_size

const size_t _Thread_Control_size

Size of the thread control block of a particular application.

This value is provided via <rtems/confdefs.h>.

See also
_Thread_Control_add_ons.

◆ _Thread_libc_reent

SCORE_EXTERN struct _reent** _Thread_libc_reent

The C library re-enter-rant global pointer.

Some C library implementations such as newlib have a single global pointer that changed during a context switch. The pointer points to that global pointer. The Thread control block holds a pointer to the task specific data.

Referenced by _Thread_Get_libc_reent().