RTEMS
Files | Classes | Macros | Typedefs | Enumerations | Functions | Variables
Thread Handler

Thread Handler. More...

Files

file  thread.h
 Constants and Structures Related with the Thread Control Block.
 
file  threaddispatch.h
 Constants and Structures Related with Thread Dispatch.
 
file  threadidledata.h
 Constants for the idle threads.
 
file  threadimpl.h
 Inlined Routines from the Thread Handler.
 
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  threaddispatch.c
 Dispatch Thread.
 
file  threadget.c
 Maps Thread IDs to TCB Pointer.
 
file  threadhandler.c
 Thread Handler.
 
file  threadinitialize.c
 Initialize Thread.
 
file  threadloadenv.c
 Initializes Enviroment for A Thread.
 
file  threadrestart.c
 Restart Thread.
 
file  threadsetstate.c
 Sets States for a Thread.
 
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.
 

Classes

struct  Thread_Entry_idle
 Data for idle thread entry. More...
 
struct  Thread_Entry_numeric
 Data for thread entry with one numeric argument and no return value. More...
 
struct  Thread_Entry_pointer
 Data for thread entry with one pointer argument and a pointer return value. More...
 
struct  Thread_Entry_information
 Thread entry information. More...
 
struct  Thread_Start_information
 
struct  Thread_Scheduler_control
 Thread scheduler control. 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_Timer_information
 Information required to manage a thread timer. More...
 
struct  Thread_Proxy_control
 
struct  Thread_Action
 Thread action. More...
 
struct  Thread_Keys_information
 Per-thread information for POSIX Keys. More...
 
struct  Thread_Action_control
 Control block to manage thread actions. More...
 
struct  Thread_Life_control
 Thread life control. More...
 
struct  Thread_Capture_control
 
struct  _Thread_Control
 
struct  Thread_Control_add_on
 Thread control add-on. More...
 
struct  Thread_Information
 The thread object information. More...
 
struct  Thread_Configuration
 The configuration of a new thread to initialize. More...
 
struct  Thread_Close_context
 

Macros

#define RTEMS_SCORE_THREAD_ENABLE_EXHAUST_TIMESLICE
 
#define RTEMS_SCORE_THREAD_ENABLE_SCHEDULER_CALLOUT
 
#define THREAD_API_FIRST   THREAD_API_RTEMS
 
#define THREAD_API_LAST   THREAD_API_POSIX
 
#define THREAD_DEFAULT_MAXIMUM_NAME_SIZE   16
 The default maximum size of a thread name in characters (including the terminating '\0' character). More...
 
#define THREAD_INFORMATION_DEFINE_ZERO(name, api, cls)
 
#define THREAD_INFORMATION_DEFINE(name, api, cls, max)
 
#define RTEMS_SCORE_ROBUST_THREAD_DISPATCH
 Enables a robust thread dispatch. More...
 
#define THREAD_OF_SCHEDULER_HELP_NODE(node)   RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node )
 
#define THREAD_QUEUE_CONTEXT_OF_REQUEST(node)   RTEMS_CONTAINER_OF( node, Thread_queue_Context, Lock_context.Wait.Gate.Node )
 
#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 an object.
 
#define THREAD_WAIT_CLASS_PERIOD   0x800U
 Indicates that the thread waits for a period.
 
#define THREAD_PIN_STEP   2
 
#define THREAD_PIN_PREEMPTION   1
 

Typedefs

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 void(* Thread_CPU_budget_algorithm_callout) (Thread_Control *)
 
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 *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)
 Thread action handler. More...
 
typedef void(* rtems_per_thread_routine) (Thread_Control *)
 
typedef struct Thread_Configured_control Thread_Configured_control
 The configured thread control block. More...
 
typedef struct Thread_queue_Configured_heads Thread_queue_Configured_heads
 The configured thread queue heads. More...
 
typedef void *(* Thread_Idle_body) (uintptr_t)
 The idle thread body type.
 
typedef bool(* Thread_Visitor) (Thread_Control *the_thread, void *arg)
 

Enumerations

enum  Thread_CPU_budget_algorithms { THREAD_CPU_BUDGET_ALGORITHM_NONE, THREAD_CPU_BUDGET_ALGORITHM_RESET_TIMESLICE, THREAD_CPU_BUDGET_ALGORITHM_EXHAUST_TIMESLICE, THREAD_CPU_BUDGET_ALGORITHM_CALLOUT }
 
enum  Thread_Scheduler_state { THREAD_SCHEDULER_BLOCKED, THREAD_SCHEDULER_SCHEDULED, THREAD_SCHEDULER_READY }
 The thread state with respect to the scheduler. More...
 
enum  Thread_APIs { THREAD_API_RTEMS, THREAD_API_POSIX }
 
enum  Thread_Life_state {
  THREAD_LIFE_PROTECTED = 0x1, THREAD_LIFE_RESTARTING = 0x2, THREAD_LIFE_TERMINATING = 0x4, THREAD_LIFE_CHANGE_DEFERRED = 0x8,
  THREAD_LIFE_DETACHED = 0x10
}
 Thread life states. More...
 

Functions

void rtems_iterate_over_all_threads (rtems_per_thread_routine routine) RTEMS_DEPRECATED
 Deprecated, use rtems_task_iterate() instead. More...
 
Objects_Control_Thread_Allocate_unlimited (Objects_Information *information)
 Return an inactive thread object or NULL. More...
 
static __inline__ bool _Thread_Dispatch_is_enabled (void)
 Indicates if the executing thread is inside a thread dispatch critical section. More...
 
static __inline__ uint32_t _Thread_Dispatch_get_disable_level (void)
 Gets thread dispatch disable level. More...
 
static __inline__ void _Thread_Dispatch_initialization (void)
 Thread dispatch initialization. More...
 
void _Thread_Dispatch (void)
 Performs a thread dispatch if necessary. More...
 
void _Thread_Dispatch_direct (Per_CPU_Control *cpu_self)
 Directly do a thread dispatch. More...
 
void _Thread_Do_dispatch (Per_CPU_Control *cpu_self, ISR_Level level)
 Performs a thread dispatch on the current processor. More...
 
static __inline__ Per_CPU_Control_Thread_Dispatch_disable_with_CPU (Per_CPU_Control *cpu_self, const ISR_lock_Context *lock_context)
 Disables thread dispatching inside a critical section (interrupts disabled) with the current processor. More...
 
static __inline__ Per_CPU_Control_Thread_Dispatch_disable_critical (const ISR_lock_Context *lock_context)
 Disables thread dispatching inside a critical section (interrupts disabled). More...
 
static __inline__ Per_CPU_Control_Thread_Dispatch_disable (void)
 Disables thread dispatching. More...
 
void _Thread_Dispatch_enable (Per_CPU_Control *cpu_self)
 Enables thread dispatching. More...
 
static __inline__ void _Thread_Dispatch_unnest (Per_CPU_Control *cpu_self)
 Unnests thread dispatching. More...
 
static __inline__ void _Thread_Dispatch_request (Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_target)
 Requests a thread dispatch on the target processor. More...
 
void _Thread_Iterate (Thread_Visitor visitor, void *arg)
 Calls the visitor with all threads and the given argument until it is done. More...
 
void _Thread_Initialize_information (Thread_Information *information)
 Initializes the thread information. More...
 
void _Thread_Handler_initialization (void)
 Initializes thread handler. More...
 
void _Thread_Create_idle (void)
 Creates idle thread. More...
 
void _Thread_Start_multitasking (void) RTEMS_NO_RETURN
 Starts thread multitasking. More...
 
bool _Thread_Initialize (Thread_Information *information, Thread_Control *the_thread, const Thread_Configuration *config)
 Initializes thread. More...
 
bool _Thread_Start (Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
 Starts the specified thread. More...
 
void _Thread_Restart_self (Thread_Control *executing, const Thread_Entry_information *entry, ISR_lock_Context *lock_context) RTEMS_NO_RETURN
 Restarts the currently executing thread. More...
 
bool _Thread_Restart_other (Thread_Control *the_thread, const Thread_Entry_information *entry, ISR_lock_Context *lock_context)
 Restarts the thread. More...
 
void _Thread_Yield (Thread_Control *executing)
 Yields the currently executing thread. More...
 
Thread_Life_state _Thread_Change_life (Thread_Life_state clear, Thread_Life_state set, Thread_Life_state ignore)
 Changes the currently executing thread to a new state with the sets. More...
 
Thread_Life_state _Thread_Set_life_protection (Thread_Life_state state)
 Set the thread to life protected. More...
 
void _Thread_Kill_zombies (void)
 Kills all zombie threads in the system. More...
 
void _Thread_Exit (Thread_Control *executing, Thread_Life_state set, void *exit_value)
 Exits the currently executing thread. More...
 
void _Thread_Join (Thread_Control *the_thread, States_Control waiting_for_join, Thread_Control *executing, Thread_queue_Context *queue_context)
 Joins the currently executing thread with the given thread to wait for. More...
 
void _Thread_Cancel (Thread_Control *the_thread, Thread_Control *executing, void *exit_value)
 Cancels the thread. More...
 
void _Thread_Close (Thread_Control *the_thread, Thread_Control *executing, Thread_Close_context *context)
 Closes the thread. More...
 
static __inline__ bool _Thread_Is_ready (const Thread_Control *the_thread)
 Checks if the thread is ready. More...
 
States_Control _Thread_Clear_state_locked (Thread_Control *the_thread, States_Control state)
 Clears the specified thread state without locking the lock context. More...
 
States_Control _Thread_Clear_state (Thread_Control *the_thread, States_Control state)
 Clears the specified thread state. More...
 
States_Control _Thread_Set_state_locked (Thread_Control *the_thread, States_Control state)
 Sets the specified thread state without locking the lock context. More...
 
States_Control _Thread_Set_state (Thread_Control *the_thread, States_Control state)
 Sets the specified thread state. More...
 
void _Thread_Load_environment (Thread_Control *the_thread)
 Initializes enviroment for a thread. More...
 
void _Thread_Entry_adaptor_idle (Thread_Control *executing)
 Calls the start kinds idle entry of the thread. More...
 
void _Thread_Entry_adaptor_numeric (Thread_Control *executing)
 Calls the start kinds numeric entry of the thread. More...
 
void _Thread_Entry_adaptor_pointer (Thread_Control *executing)
 Calls the start kinds pointer entry of the thread. More...
 
void _Thread_Handler (void)
 Wrapper function for all threads. More...
 
static __inline__ void _Thread_State_acquire_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the lock context in a critical section. More...
 
static __inline__ void _Thread_State_acquire (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Disables interrupts and acquires the lock_context. More...
 
static __inline__ Thread_Control_Thread_State_acquire_for_executing (ISR_lock_Context *lock_context)
 Disables interrupts and acquires the lock context for the currently executing thread. More...
 
static __inline__ void _Thread_State_release_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Release the lock context in a critical section. More...
 
static __inline__ void _Thread_State_release (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the lock context and enables interrupts. More...
 
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. More...
 
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. More...
 
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. More...
 
void _Thread_Priority_changed (Thread_Control *the_thread, Priority_Node *priority_node, bool prepend_it, Thread_queue_Context *queue_context)
 Propagates a thread priority value change in the specified thread priority node to the corresponding thread priority aggregation. More...
 
static __inline__ void _Thread_Priority_change (Thread_Control *the_thread, Priority_Node *priority_node, Priority_Control new_priority, bool prepend_it, Thread_queue_Context *queue_context)
 Changes the thread priority value of the specified thread priority node in the corresponding thread priority aggregation. More...
 
void _Thread_Priority_replace (Thread_Control *the_thread, Priority_Node *victim_node, Priority_Node *replacement_node)
 Replaces the victim priority node with the replacement priority node in the corresponding thread priority aggregation. More...
 
void _Thread_Priority_update (Thread_queue_Context *queue_context)
 Updates the priority of all threads in the set. More...
 
void _Thread_Priority_and_sticky_update (Thread_Control *the_thread, int sticky_level_change)
 Updates the priority of the thread and changes it sticky level. More...
 
static __inline__ bool _Thread_Priority_less_than (Priority_Control left, Priority_Control right)
 Checks if the left thread priority is less than the right thread priority in the intuitive sense of priority. More...
 
static __inline__ Priority_Control _Thread_Priority_highest (Priority_Control left, Priority_Control right)
 Returns the highest priority of the left and right thread priorities in the intuitive sense of priority. More...
 
static __inline__ Objects_Information_Thread_Get_objects_information (Objects_Id id)
 Gets object information for the object id. More...
 
Thread_Control_Thread_Get (Objects_Id id, ISR_lock_Context *lock_context)
 Gets a thread by its identifier. More...
 
static __inline__ Per_CPU_Control_Thread_Get_CPU (const Thread_Control *thread)
 Gets the cpu of the thread's scheduler. More...
 
static __inline__ void _Thread_Set_CPU (Thread_Control *thread, Per_CPU_Control *cpu)
 Sets the cpu of the thread's scheduler. More...
 
static __inline__ bool _Thread_Is_executing (const Thread_Control *the_thread)
 Checks if the thread is the currently executing thread. More...
 
static __inline__ bool _Thread_Is_executing_on_a_processor (const Thread_Control *the_thread)
 Checks if the thread executes currently on some processor in the system. More...
 
static __inline__ bool _Thread_Is_heir (const Thread_Control *the_thread)
 Checks if the thread is the heir. More...
 
static __inline__ void _Thread_Unblock (Thread_Control *the_thread)
 Unblocks the thread. More...
 
static __inline__ void _Thread_Save_fp (Thread_Control *executing)
 Checks if the floating point context of the thread is currently loaded in the floating point unit. More...
 
static __inline__ void _Thread_Restore_fp (Thread_Control *executing)
 Restores the executing thread's floating point area. More...
 
static __inline__ bool _Thread_Is_context_switch_necessary (void)
 Deallocates the currently loaded floating point context. More...
 
static __inline__ bool _Thread_Is_null (const Thread_Control *the_thread)
 Checks if the thread is NULL. More...
 
static __inline__ uint32_t _Thread_Get_maximum_internal_threads (void)
 Gets the maximum number of internal threads. More...
 
static __inline__ Thread_Control_Thread_Internal_allocate (void)
 Allocates an internal thread and returns it. More...
 
static __inline__ Thread_Control_Thread_Get_heir_and_make_it_executing (Per_CPU_Control *cpu_self)
 Gets the heir of the processor and makes it executing. More...
 
static __inline__ void _Thread_Update_CPU_time_used (Thread_Control *the_thread, Per_CPU_Control *cpu)
 Updates the cpu time used of the thread. More...
 
static __inline__ void _Thread_Dispatch_update_heir (Per_CPU_Control *cpu_self, Per_CPU_Control *cpu_for_heir, Thread_Control *heir)
 Updates the used cpu time for the heir and dispatches a new heir. More...
 
void _Thread_Get_CPU_time_used (Thread_Control *the_thread, Timestamp_Control *cpu_time_used)
 Gets the used cpu time of the thread and stores it in the given Timestamp_Control. More...
 
static __inline__ void _Thread_Action_control_initialize (Thread_Action_control *action_control)
 Initializes the control chain of the action control. More...
 
static __inline__ void _Thread_Action_initialize (Thread_Action *action)
 Initializes the Thread action. More...
 
static __inline__ void _Thread_Add_post_switch_action (Thread_Control *the_thread, Thread_Action *action, Thread_Action_handler handler)
 Adds a post switch action to the thread with the given handler. More...
 
static __inline__ bool _Thread_Is_life_restarting (Thread_Life_state life_state)
 Checks if the thread life state is restarting. More...
 
static __inline__ bool _Thread_Is_life_terminating (Thread_Life_state life_state)
 Checks if the thread life state is terminating. More...
 
static __inline__ bool _Thread_Is_life_change_allowed (Thread_Life_state life_state)
 Checks if the thread life state allos life change. More...
 
static __inline__ bool _Thread_Is_life_changing (Thread_Life_state life_state)
 Checks if the thread life state is life changing. More...
 
static __inline__ bool _Thread_Is_joinable (const Thread_Control *the_thread)
 Checks if the thread is joinable. More...
 
static __inline__ void _Thread_Resource_count_increment (Thread_Control *the_thread)
 Increments the thread's resource count. More...
 
static __inline__ void _Thread_Resource_count_decrement (Thread_Control *the_thread)
 Decrements the thread's resource count. More...
 
static __inline__ void _Thread_Scheduler_cancel_need_for_help (Thread_Control *the_thread, Per_CPU_Control *cpu)
 Cancels the thread's need for help. More...
 
static __inline__ const Scheduler_Control_Thread_Scheduler_get_home (const Thread_Control *the_thread)
 Gets the home scheduler of the thread. More...
 
static __inline__ Scheduler_Node_Thread_Scheduler_get_home_node (const Thread_Control *the_thread)
 Gets the scheduler's home node. More...
 
static __inline__ Scheduler_Node_Thread_Scheduler_get_node_by_index (const Thread_Control *the_thread, size_t scheduler_index)
 Gets the thread's scheduler node by index. More...
 
static __inline__ void _Thread_Scheduler_acquire_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the lock context in a critical section. More...
 
static __inline__ void _Thread_Scheduler_release_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the lock context in a critical section. More...
 
void _Thread_Scheduler_process_requests (Thread_Control *the_thread)
 Process the thread's scheduler requests. More...
 
static __inline__ void _Thread_Scheduler_add_request (Thread_Control *the_thread, Scheduler_Node *scheduler_node, Scheduler_Node_request request)
 Add a scheduler request to the thread. More...
 
static __inline__ void _Thread_Scheduler_add_wait_node (Thread_Control *the_thread, Scheduler_Node *scheduler_node)
 Adds a wait node to the thread and adds a corresponding request to the thread. More...
 
static __inline__ void _Thread_Scheduler_remove_wait_node (Thread_Control *the_thread, Scheduler_Node *scheduler_node)
 Remove a wait node from the thread and add a corresponding request to it. More...
 
static __inline__ Priority_Control _Thread_Get_priority (const Thread_Control *the_thread)
 Returns the priority of the thread. More...
 
static __inline__ Priority_Control _Thread_Get_unmapped_priority (const Thread_Control *the_thread)
 Returns the unmapped priority of the thread. More...
 
static __inline__ Priority_Control _Thread_Get_unmapped_real_priority (const Thread_Control *the_thread)
 Returns the unmapped real priority of the thread. More...
 
static __inline__ void _Thread_Wait_acquire_default_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the thread wait default lock inside a critical section (interrupts disabled). More...
 
static __inline__ Thread_Control_Thread_Wait_acquire_default_for_executing (ISR_lock_Context *lock_context)
 Acquires the thread wait default lock and returns the executing thread. More...
 
static __inline__ void _Thread_Wait_acquire_default (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Acquires the thread wait default lock and disables interrupts. More...
 
static __inline__ void _Thread_Wait_release_default_critical (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the thread wait default lock inside a critical section (interrupts disabled). More...
 
static __inline__ void _Thread_Wait_release_default (Thread_Control *the_thread, ISR_lock_Context *lock_context)
 Releases the thread wait default lock and restores the previous interrupt status. More...
 
static __inline__ void _Thread_Wait_remove_request_locked (Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
 Removes the first pending wait lock request. More...
 
static __inline__ void _Thread_Wait_acquire_queue_critical (Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
 Acquires the wait queue inside a critical section. More...
 
static __inline__ void _Thread_Wait_release_queue_critical (Thread_queue_Queue *queue, Thread_queue_Lock_context *queue_lock_context)
 Releases the wait queue inside a critical section. More...
 
static __inline__ void _Thread_Wait_acquire_critical (Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Acquires the thread wait lock inside a critical section (interrupts disabled). More...
 
static __inline__ void _Thread_Wait_acquire (Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Acquires the thread wait default lock and disables interrupts. More...
 
static __inline__ void _Thread_Wait_release_critical (Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Releases the thread wait lock inside a critical section (interrupts disabled). More...
 
static __inline__ void _Thread_Wait_release (Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Releases the thread wait lock and restores the previous interrupt status. More...
 
static __inline__ void _Thread_Wait_claim (Thread_Control *the_thread, Thread_queue_Queue *queue)
 Claims the thread wait queue. More...
 
static __inline__ void _Thread_Wait_claim_finalize (Thread_Control *the_thread, const Thread_queue_Operations *operations)
 Finalizes the thread wait queue claim via registration of the corresponding thread queue operations. More...
 
static __inline__ void _Thread_Wait_remove_request (Thread_Control *the_thread, Thread_queue_Lock_context *queue_lock_context)
 Removes a thread wait lock request. More...
 
static __inline__ void _Thread_Wait_restore_default (Thread_Control *the_thread)
 Restores the default thread wait queue and operations. More...
 
static __inline__ void _Thread_Wait_tranquilize (Thread_Control *the_thread)
 Tranquilizes the thread after a wait on a thread queue. More...
 
static __inline__ void _Thread_Wait_cancel (Thread_Control *the_thread, Thread_queue_Context *queue_context)
 Cancels a thread wait on a thread queue. More...
 
static __inline__ void _Thread_Wait_flags_set (Thread_Control *the_thread, Thread_Wait_flags flags)
 Sets the thread's wait flags. More...
 
static __inline__ Thread_Wait_flags _Thread_Wait_flags_get (const Thread_Control *the_thread)
 Gets the thread's wait flags according to the ATOMIC_ORDER_RELAXED. More...
 
static __inline__ Thread_Wait_flags _Thread_Wait_flags_get_acquire (const Thread_Control *the_thread)
 Gets the thread's wait flags according to the ATOMIC_ORDER_ACQUIRE. More...
 
static __inline__ bool _Thread_Wait_flags_try_change_release (Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
 Tries to change the thread wait flags with release semantics in case of success. More...
 
static __inline__ bool _Thread_Wait_flags_try_change_acquire (Thread_Control *the_thread, Thread_Wait_flags expected_flags, Thread_Wait_flags desired_flags)
 Tries to change the thread wait flags with acquire semantics. More...
 
Objects_Id _Thread_Wait_get_id (const Thread_Control *the_thread)
 Returns the object identifier of the object containing the current thread wait queue. More...
 
static __inline__ Status_Control _Thread_Wait_get_status (const Thread_Control *the_thread)
 Get the status of the wait return code of the thread. More...
 
void _Thread_Continue (Thread_Control *the_thread, Status_Control status)
 Cancels a blocking operation so that the thread can continue its execution. More...
 
void _Thread_Timeout (Watchdog_Control *the_watchdog)
 General purpose thread wait timeout. More...
 
static __inline__ void _Thread_Timer_initialize (Thread_Timer_information *timer, Per_CPU_Control *cpu)
 Initializes the thread timer. More...
 
static __inline__ void _Thread_Add_timeout_ticks (Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Interval ticks)
 Adds timeout ticks to the thread. More...
 
static __inline__ void _Thread_Timer_insert_realtime (Thread_Control *the_thread, Per_CPU_Control *cpu, Watchdog_Service_routine_entry routine, uint64_t expire)
 Inserts the cpu's watchdog realtime into the thread's timer. More...
 
static __inline__ void _Thread_Timer_remove (Thread_Control *the_thread)
 Remove the watchdog timer from the thread. More...
 
static __inline__ void _Thread_Remove_timer_and_unblock (Thread_Control *the_thread, Thread_queue_Queue *queue)
 Remove the watchdog timer from the thread and unblock if necessary. More...
 
Status_Control _Thread_Set_name (Thread_Control *the_thread, const char *name)
 Sets the name of the thread. More...
 
size_t _Thread_Get_name (const Thread_Control *the_thread, char *buffer, size_t buffer_size)
 Gets the name of the thread. More...
 
void _Thread_Do_unpin (Thread_Control *executing, Per_CPU_Control *cpu_self)
 Unpins the thread. More...
 
static __inline__ void _Thread_Pin (Thread_Control *executing)
 Pin the executing thread. More...
 
static __inline__ void _Thread_Unpin (Thread_Control *executing, Per_CPU_Control *cpu_self)
 Unpins the thread. More...
 

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_Initial_thread_count
 Count of configured threads. More...
 
const size_t _Thread_Maximum_name_size
 Maximum size of a thread name in characters (including the terminating '\0' character). More...
 
const size_t _Thread_Maximum_TLS_size
 If this constant is greater than zero, then it defines the maximum thread-local storage size, otherwise the thread-local storage size is defined by the linker depending on the thread-local storage objects used by the application in the statically-linked executable. More...
 
const size_t _Thread_queue_Heads_size
 Size of the thread queue heads of a particular application. More...
 
Thread_Information _Thread_Information
 The internal thread objects information.
 
char _Thread_Idle_stacks []
 The idle thread stacks. More...
 
const size_t _Thread_Idle_stack_size
 The idle thread stack size in bytes. More...
 
const Thread_Idle_body _Thread_Idle_body
 The idle thread body. More...
 
void * rtems_ada_self
 
Objects_Id _Thread_Global_constructor
 Object identifier of the global constructor thread. More...
 

Detailed Description

Thread Handler.

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

◆ RTEMS_SCORE_ROBUST_THREAD_DISPATCH

#define RTEMS_SCORE_ROBUST_THREAD_DISPATCH

Enables a robust thread dispatch.

On each change of the thread dispatch disable level from one to zero the interrupt status is checked. In case interrupts are disabled and SMP is enabled or the CPU port needs it, then the system terminates with the fatal internal error INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT.

Definition at line 44 of file threaddispatch.h.

◆ THREAD_API_FIRST

#define THREAD_API_FIRST   THREAD_API_RTEMS

This macro defines the first API which has threads.

Definition at line 590 of file thread.h.

◆ THREAD_API_LAST

#define THREAD_API_LAST   THREAD_API_POSIX

This macro defines the last API which has threads.

Definition at line 593 of file thread.h.

◆ THREAD_DEFAULT_MAXIMUM_NAME_SIZE

#define THREAD_DEFAULT_MAXIMUM_NAME_SIZE   16

The default maximum size of a thread name in characters (including the terminating '\0' character).

This is the default value for the application configuration option CONFIGURE_MAXIMUM_THREAD_NAME_SIZE.

Definition at line 946 of file thread.h.

◆ THREAD_INFORMATION_DEFINE

#define THREAD_INFORMATION_DEFINE (   name,
  api,
  cls,
  max 
)
Value:
static Objects_Control * \
name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \
static Thread_Configured_control \
name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \
static Thread_queue_Configured_heads \
name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \
Thread_Information name##_Information = { \
{ \
_Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \
name##_Local_table, \
_Objects_Is_unlimited( max ) ? \
_Thread_Allocate_unlimited : _Objects_Allocate_static, \
_Objects_Is_unlimited( max ) ? \
_Objects_Free_unlimited : _Objects_Free_static, \
0, \
_Objects_Is_unlimited( max ) ? _Objects_Maximum_per_allocation( max ) : 0, \
CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
NULL, \
NULL, \
&name##_Objects[ 0 ].Control.Object \
OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ) \
}, { \
&name##_Heads[ 0 ] \
} \
}
#define OBJECTS_NO_STRING_NAME
Constant for the object information string name length to indicate that this object class has no stri...
Definition: objectdata.h:101
#define CHAIN_INITIALIZER_EMPTY(name)
Chain initializer for an empty chain with designator name.
Definition: chainimpl.h:39
void _Objects_Free_static(Objects_Information *information, Objects_Control *the_object)
Free the object.
struct Thread_Configured_control Thread_Configured_control
The configured thread control block.
Definition: thread.h:972
Objects_Control * _Objects_Allocate_static(Objects_Information *information)
Return an inactive object or NULL.

Definition at line 1060 of file thread.h.

◆ THREAD_INFORMATION_DEFINE_ZERO

#define THREAD_INFORMATION_DEFINE_ZERO (   name,
  api,
  cls 
)
Value:
Thread_Information name##_Information = { \
{ \
_Objects_Build_id( api, cls, 1, 0 ), \
NULL, \
_Objects_Allocate_none, \
NULL, \
0, \
0, \
0, \
0, \
CHAIN_INITIALIZER_EMPTY( name##_Information.Objects.Inactive ), \
NULL, \
NULL, \
NULL \
OBJECTS_INFORMATION_MP( name##_Information.Objects, NULL ), \
}, { \
NULL \
} \
}
The thread object information.
Definition: thread.h:1000

Definition at line 1031 of file thread.h.

◆ THREAD_OF_SCHEDULER_HELP_NODE

#define THREAD_OF_SCHEDULER_HELP_NODE (   node)    RTEMS_CONTAINER_OF( node, Thread_Control, Scheduler.Help_node )

The following points to the thread whose floating point context is currently loaded.

Definition at line 76 of file threadimpl.h.

◆ 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.

Definition at line 2151 of file threadimpl.h.

◆ 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.

Definition at line 2163 of file threadimpl.h.

Typedef Documentation

◆ Thread_Action_handler

typedef void( * Thread_Action_handler) (Thread_Control *the_thread, Thread_Action *action, ISR_lock_Context *lock_context)

Thread action handler.

The thread action handler will be called with interrupts disabled and a corresponding lock acquired, e.g. _Thread_State_acquire(). The handler must release the corresponding lock, e.g. _Thread_State_release(). So, the corresponding lock may be used to protect private data used by the particular action.

Since the action is passed to the handler additional data may be accessed via RTEMS_CONTAINER_OF().

Parameters
[in]the_threadThe thread performing the action.
[in]actionThe thread action.
[in]lock_contextThe lock context to use for the lock release.

Definition at line 613 of file thread.h.

◆ Thread_Configured_control

The configured thread control block.

This type is defined in <rtems/confdefs.h> and depends on the application configuration.

Definition at line 972 of file thread.h.

◆ Thread_CPU_budget_algorithm_callout

typedef void(* Thread_CPU_budget_algorithm_callout) (Thread_Control *)

This defines thes the entry point for the thread specific timeslice budget management algorithm.

Definition at line 172 of file thread.h.

◆ 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.

Definition at line 101 of file thread.h.

◆ Thread_queue_Configured_heads

The configured thread queue heads.

In SMP configurations, this type is defined in <rtems/confdefs.h> and depends on the application configuration.

Definition at line 981 of file thread.h.

◆ 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

Definition at line 383 of file thread.h.

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.

Definition at line 582 of file thread.h.

◆ 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.

Definition at line 158 of file thread.h.

◆ 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.

The individual state values must be a power of two to allow use of bit operations to manipulate and evaluate the thread life state.

Definition at line 672 of file thread.h.

◆ Thread_Scheduler_state

The thread state with respect to the scheduler.

Enumerator
THREAD_SCHEDULER_BLOCKED 

This thread is blocked with respect to the scheduler.

This thread uses no scheduler nodes.

THREAD_SCHEDULER_SCHEDULED 

This thread is scheduled with respect to the scheduler.

This thread executes using one of its scheduler nodes. This could be its own scheduler node or in case it owns resources taking part in the scheduler helping protocol a scheduler node of another thread.

THREAD_SCHEDULER_READY 

This thread is ready with respect to the scheduler.

None of the scheduler nodes of this thread is scheduled.

Definition at line 214 of file thread.h.

Function Documentation

◆ _Thread_Action_control_initialize()

static __inline__ void _Thread_Action_control_initialize ( Thread_Action_control action_control)
static

Initializes the control chain of the action control.

Parameters
[out]action_controlThe action control to initialize.

Definition at line 1208 of file threadimpl.h.

◆ _Thread_Action_initialize()

static __inline__ void _Thread_Action_initialize ( Thread_Action action)
static

Initializes the Thread action.

Parameters
[out]actionThe Thread_Action to initialize.

Definition at line 1220 of file threadimpl.h.

◆ _Thread_Add_post_switch_action()

static __inline__ void _Thread_Add_post_switch_action ( Thread_Control the_thread,
Thread_Action action,
Thread_Action_handler  handler 
)
static

Adds a post switch action to the thread with the given handler.

Parameters
[in,out]the_threadThe thread.
[in,out]actionThe action to add.
handlerThe handler for the action.

Definition at line 1234 of file threadimpl.h.

◆ _Thread_Add_timeout_ticks()

static __inline__ void _Thread_Add_timeout_ticks ( Thread_Control the_thread,
Per_CPU_Control cpu,
Watchdog_Interval  ticks 
)
static

Adds timeout ticks to the thread.

Parameters
[in,out]the_threadThe thread to add the timeout ticks to.
cpuThe cpu for the operation.
ticksThe ticks to add to the timeout ticks.

Definition at line 2405 of file threadimpl.h.

◆ _Thread_Allocate_unlimited()

Objects_Control* _Thread_Allocate_unlimited ( Objects_Information information)

Return an inactive thread object or NULL.

Return values
NULLNo inactive object is available.
objectAn inactive object.

◆ _Thread_Cancel()

void _Thread_Cancel ( Thread_Control the_thread,
Thread_Control executing,
void *  exit_value 
)

Cancels the thread.

Parameters
[in,out]the_threadThe thread to cancel.
executingThe currently executing thread.
exit_valueThe exit value for the thread.

Definition at line 459 of file threadrestart.c.

◆ _Thread_Change_life()

Thread_Life_state _Thread_Change_life ( Thread_Life_state  clear,
Thread_Life_state  set,
Thread_Life_state  ignore 
)

Changes the currently executing thread to a new state with the sets.

Parameters
clearStates to clear.
setStates to set.
ignoreStates to ignore.
Returns
The previous state the thread was in.

Definition at line 658 of file threadrestart.c.

◆ _Thread_Clear_state()

States_Control _Thread_Clear_state ( Thread_Control the_thread,
States_Control  state 
)

Clears the specified thread state.

In the 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,out]the_threadThe thread.
stateThe state to clear. It must not be zero.
Returns
The previous state.

Definition at line 51 of file threadclearstate.c.

◆ _Thread_Clear_state_locked()

States_Control _Thread_Clear_state_locked ( Thread_Control the_thread,
States_Control  state 
)

Clears the specified thread state without locking the lock context.

In the 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,out]the_threadThe thread.
stateThe state to clear. It must not be zero.
Returns
The thread's previous state.

Definition at line 25 of file threadclearstate.c.

◆ _Thread_Close()

void _Thread_Close ( Thread_Control the_thread,
Thread_Control executing,
Thread_Close_context context 
)

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.

Parameters
the_threadThe thread to close.
executingThe currently executing thread.
[in,out]contextThe thread close context.

Definition at line 518 of file threadrestart.c.

◆ _Thread_Continue()

void _Thread_Continue ( Thread_Control the_thread,
Status_Control  status 
)

Cancels a blocking operation so that the thread can continue its execution.

In case this function actually cancelled the blocking operation, then the thread wait return code is set to the specified status.

A specialization of this function is _Thread_Timeout().

Parameters
[in,out]the_threadThe thread.
statusThe thread wait status.

Definition at line 25 of file threadtimeout.c.

◆ _Thread_Create_idle()

void _Thread_Create_idle ( void  )

Creates idle thread.

This routine creates the idle thread.

Warning
No thread should be created before this one.

Definition at line 93 of file threadcreateidle.c.

◆ _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.

Definition at line 331 of file threaddispatch.c.

◆ _Thread_Dispatch_direct()

void _Thread_Dispatch_direct ( Per_CPU_Control cpu_self)

Directly do a thread dispatch.

Must be called with a thread dispatch disable level of one, otherwise the INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL will occur. This function is useful for operations which synchronously block, e.g. self restart, self deletion, yield, sleep.

Parameters
cpu_selfThe current processor.
See also
_Thread_Dispatch().

Definition at line 350 of file threaddispatch.c.

◆ _Thread_Dispatch_disable()

static __inline__ Per_CPU_Control* _Thread_Dispatch_disable ( void  )
static

Disables thread dispatching.

Returns
The current processor.

Definition at line 191 of file threaddispatch.h.

◆ _Thread_Dispatch_disable_critical()

static __inline__ Per_CPU_Control* _Thread_Dispatch_disable_critical ( const ISR_lock_Context lock_context)
static

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

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

Definition at line 179 of file threaddispatch.h.

◆ _Thread_Dispatch_disable_with_CPU()

static __inline__ Per_CPU_Control* _Thread_Dispatch_disable_with_CPU ( Per_CPU_Control cpu_self,
const ISR_lock_Context lock_context 
)
static

Disables thread dispatching inside a critical section (interrupts disabled) with the current processor.

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

Definition at line 152 of file threaddispatch.h.

◆ _Thread_Dispatch_enable()

void _Thread_Dispatch_enable ( Per_CPU_Control cpu_self)

Enables thread dispatching.

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

Parameters
[in,out]cpu_selfThe current processor.

Definition at line 362 of file threaddispatch.c.

◆ _Thread_Dispatch_get_disable_level()

static __inline__ uint32_t _Thread_Dispatch_get_disable_level ( void  )
static

Gets thread dispatch disable level.

Returns
The value of the thread dispatch level.

Definition at line 79 of file threaddispatch.h.

◆ _Thread_Dispatch_initialization()

static __inline__ void _Thread_Dispatch_initialization ( void  )
static

Thread dispatch initialization.

This routine initializes the thread dispatching subsystem.

Definition at line 89 of file threaddispatch.h.

◆ _Thread_Dispatch_is_enabled()

static __inline__ bool _Thread_Dispatch_is_enabled ( void  )
static

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.

Definition at line 55 of file threaddispatch.h.

◆ _Thread_Dispatch_request()

static __inline__ void _Thread_Dispatch_request ( Per_CPU_Control cpu_self,
Per_CPU_Control cpu_target 
)
static

Requests a thread dispatch on the target processor.

Parameters
[in,out]cpu_selfThe current processor.
[in,out]cpu_targetThe target processor to request a thread dispatch.

Definition at line 235 of file threaddispatch.h.

◆ _Thread_Dispatch_unnest()

static __inline__ void _Thread_Dispatch_unnest ( Per_CPU_Control cpu_self)
static

Unnests thread dispatching.

Parameters
[in,out]cpu_selfThe current processor.

Definition at line 223 of file threaddispatch.h.

◆ _Thread_Dispatch_update_heir()

static __inline__ void _Thread_Dispatch_update_heir ( Per_CPU_Control cpu_self,
Per_CPU_Control cpu_for_heir,
Thread_Control heir 
)
static

Updates the used cpu time for the heir and dispatches a new heir.

Parameters
[in,out]cpu_selfThe current processor.
[in,out]cpu_for_heirThe processor to do a dispatch on.
heirThe new heir for cpu_for_heir.

Definition at line 1177 of file threadimpl.h.

◆ _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
cpu_selfThe current processor.
levelThe previous interrupt level.
See also
_Thread_Dispatch().

Definition at line 259 of file threaddispatch.c.

◆ _Thread_Do_unpin()

void _Thread_Do_unpin ( Thread_Control executing,
Per_CPU_Control cpu_self 
)

Unpins the thread.

Parameters
executingThe currently executing thread.
cpu_selfThe cpu for the operation.

Definition at line 15 of file threadunpin.c.

◆ _Thread_Entry_adaptor_idle()

void _Thread_Entry_adaptor_idle ( Thread_Control executing)

Calls the start kinds idle entry of the thread.

Parameters
executingThe currently executing thread.

Definition at line 21 of file threadentryadaptoridle.c.

◆ _Thread_Entry_adaptor_numeric()

void _Thread_Entry_adaptor_numeric ( Thread_Control executing)

Calls the start kinds numeric entry of the thread.

Parameters
executingThe currently executing thread.

Definition at line 21 of file threadentryadaptornumeric.c.

◆ _Thread_Entry_adaptor_pointer()

void _Thread_Entry_adaptor_pointer ( Thread_Control executing)

Calls the start kinds pointer entry of the thread.

Stores the return value in the Wait.return_argument of the thread.

Parameters
executingThe currently executing thread.

◆ _Thread_Exit()

void _Thread_Exit ( Thread_Control executing,
Thread_Life_state  set,
void *  exit_value 
)

Exits the currently executing thread.

Parameters
[in,out]executingThe currently executing thread.
setThe states to set.
[out]exit_valueContains the exit value of the thread.

Definition at line 541 of file threadrestart.c.

◆ _Thread_Get()

Thread_Control* _Thread_Get ( Objects_Id  id,
ISR_lock_Context lock_context 
)

Gets a thread by its identifier.

See also
_Objects_Get().
Parameters
idThe id of the thread.
lock_contextThe lock context.

Definition at line 24 of file threadget.c.

◆ _Thread_Get_CPU()

static __inline__ Per_CPU_Control* _Thread_Get_CPU ( const Thread_Control thread)
static

Gets the cpu of the thread's scheduler.

Parameters
threadThe thread.
Returns
The cpu of the thread's scheduler.

Definition at line 867 of file threadimpl.h.

◆ _Thread_Get_CPU_time_used()

void _Thread_Get_CPU_time_used ( Thread_Control the_thread,
Timestamp_Control cpu_time_used 
)

Gets the used cpu time of the thread and stores it in the given Timestamp_Control.

Parameters
the_threadThe thread to get the used cpu time of.
[out]cpu_time_usedStores the used cpu time of the_thread.

Definition at line 31 of file threadgetcputimeused.c.

◆ _Thread_Get_heir_and_make_it_executing()

static __inline__ Thread_Control* _Thread_Get_heir_and_make_it_executing ( Per_CPU_Control cpu_self)
static

Gets the heir of the processor and makes it executing.

Must be called with interrupts disabled. The thread dispatch necessary indicator is cleared as a side-effect.

Parameters
[in,out]cpu_selfThe processor to get the heir of.
Returns
The heir thread.
See also
_Thread_Dispatch(), _Thread_Start_multitasking() and _Thread_Dispatch_update_heir().

Definition at line 1135 of file threadimpl.h.

◆ _Thread_Get_maximum_internal_threads()

static __inline__ uint32_t _Thread_Get_maximum_internal_threads ( void  )
static

Gets the maximum number of internal threads.

Returns
The maximum number of internal threads.

Definition at line 1094 of file threadimpl.h.

◆ _Thread_Get_name()

size_t _Thread_Get_name ( const Thread_Control the_thread,
char *  buffer,
size_t  buffer_size 
)

Gets the name of the thread.

Parameters
the_threadThe thread to get the name of.
[out]bufferContains the thread's name.
buffer_sizeThe size of buffer.
Returns
The number of bytes copied to buffer.

◆ _Thread_Get_objects_information()

static __inline__ Objects_Information* _Thread_Get_objects_information ( Objects_Id  id)
static

Gets object information for the object id.

Parameters
idThe id of the object information.
Return values
pointerThe object information for this id.
NULLThe object id is not valid.

Definition at line 826 of file threadimpl.h.

◆ _Thread_Get_priority()

static __inline__ Priority_Control _Thread_Get_priority ( const Thread_Control the_thread)
static

Returns the priority of the thread.

Returns the user API and thread wait information relevant thread priority. This includes temporary thread priority adjustments due to locking protocols, a job release or the POSIX sporadic server for example.

Parameters
the_threadThe thread of which to get the priority.
Returns
The priority of the thread.

Definition at line 1610 of file threadimpl.h.

◆ _Thread_Get_unmapped_priority()

static __inline__ Priority_Control _Thread_Get_unmapped_priority ( const Thread_Control the_thread)
static

Returns the unmapped priority of the thread.

Parameters
the_threadThe thread of which to get the unmapped priority.
Returns
The unmapped priority of the thread.

Definition at line 1627 of file threadimpl.h.

◆ _Thread_Get_unmapped_real_priority()

static __inline__ Priority_Control _Thread_Get_unmapped_real_priority ( const Thread_Control the_thread)
static

Returns the unmapped real priority of the thread.

Parameters
the_threadThe thread of which to get the unmapped real priority.
Returns
The unmapped real priority of the thread.

Definition at line 1641 of file threadimpl.h.

◆ _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.

Definition at line 76 of file threadhandler.c.

◆ _Thread_Handler_initialization()

void _Thread_Handler_initialization ( void  )

Initializes thread handler.

This routine performs the initialization necessary for this handler.

Definition at line 58 of file thread.c.

◆ _Thread_Initialize()

bool _Thread_Initialize ( Thread_Information information,
Thread_Control the_thread,
const Thread_Configuration config 
)

Initializes 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.
Parameters
informationThe thread information.
the_threadThe thread to initialize.
configThe configuration of the thread to initialize.
Return values
trueThe thread initialization was successful.
falseThe thread initialization failed.

Definition at line 30 of file threadinitialize.c.

◆ _Thread_Initialize_information()

void _Thread_Initialize_information ( Thread_Information information)

Initializes the thread information.

Parameters
[out]informationInformation to initialize.

Definition at line 46 of file thread.c.

◆ _Thread_Internal_allocate()

static __inline__ Thread_Control* _Thread_Internal_allocate ( void  )
static

Allocates an internal thread and returns it.

Return values
pointerPointer to the allocated Thread_Control.
NULLThe operation failed.

Definition at line 1116 of file threadimpl.h.

◆ _Thread_Is_context_switch_necessary()

static __inline__ bool _Thread_Is_context_switch_necessary ( void  )
static

Deallocates the currently loaded floating point context.

This routine is invoked when the currently loaded floating point context is now longer associated with an active thread. Checks if dispatching is disabled.

This function returns true if dispatching is disabled, and false otherwise.

Return values
trueDispatching is disabled.
falseDispatching is enabled.

Definition at line 1069 of file threadimpl.h.

◆ _Thread_Is_executing()

static __inline__ bool _Thread_Is_executing ( const Thread_Control the_thread)
static

Checks if the thread is the currently executing thread.

This function returns true if the_thread is the currently executing thread, and false otherwise.

Parameters
the_threadThe thread to verify if it is the currently executing thread.
Return values
truethe_thread is the currently executing one.
falsethe_thread is not the currently executing one.

Definition at line 910 of file threadimpl.h.

◆ _Thread_Is_executing_on_a_processor()

static __inline__ bool _Thread_Is_executing_on_a_processor ( const Thread_Control the_thread)
static

Checks if the thread executes currently on some processor in the system.

Do not confuse this with _Thread_Is_executing() which checks only the current processor.

Parameters
the_threadThe thread for the verification.
Return values
truethe_thread is the currently executing one.
falsethe_thread is not the currently executing one.

Definition at line 930 of file threadimpl.h.

◆ _Thread_Is_heir()

static __inline__ bool _Thread_Is_heir ( const Thread_Control the_thread)
static

Checks if the thread is the heir.

This function returns true if the_thread is the heir thread, and false otherwise.

Parameters
the_threadThe thread for the verification.
Return values
truethe_thread is the heir.
falsethe_thread is not the heir.

Definition at line 949 of file threadimpl.h.

◆ _Thread_Is_joinable()

static __inline__ bool _Thread_Is_joinable ( const Thread_Control the_thread)
static

Checks if the thread is joinable.

Parameters
the_threadThe thread for the verification.
Return values
truelife_state is joinable.
falselife_state is not joinable.

Definition at line 1326 of file threadimpl.h.

◆ _Thread_Is_life_change_allowed()

static __inline__ bool _Thread_Is_life_change_allowed ( Thread_Life_state  life_state)
static

Checks if the thread life state allos life change.

Parameters
life_stateThe thread life state for the verification.
Return values
truelife_state allows life change.
falselife_state does not allow life change.

Definition at line 1294 of file threadimpl.h.

◆ _Thread_Is_life_changing()

static __inline__ bool _Thread_Is_life_changing ( Thread_Life_state  life_state)
static

Checks if the thread life state is life changing.

Parameters
life_stateThe thread life state for the verification.
Return values
truelife_state is life changing.
falselife_state is not life changing.

Definition at line 1310 of file threadimpl.h.

◆ _Thread_Is_life_restarting()

static __inline__ bool _Thread_Is_life_restarting ( Thread_Life_state  life_state)
static

Checks if the thread life state is restarting.

Parameters
life_stateThe thread life state for the verification.
Return values
truelife_state is restarting.
falselife_state is not restarting.

Definition at line 1264 of file threadimpl.h.

◆ _Thread_Is_life_terminating()

static __inline__ bool _Thread_Is_life_terminating ( Thread_Life_state  life_state)
static

Checks if the thread life state is terminating.

Parameters
life_stateThe thread life state for the verification.
Return values
truelife_state is terminating.
falselife_state is not terminating.

Definition at line 1279 of file threadimpl.h.

◆ _Thread_Is_null()

static __inline__ bool _Thread_Is_null ( const Thread_Control the_thread)
static

Checks if the thread is NULL.

Parameters
the_threadThe thread for the verification.
Return values
trueThe thread is NULL.
falseThe thread is not NULL.

Definition at line 1082 of file threadimpl.h.

◆ _Thread_Is_ready()

static __inline__ bool _Thread_Is_ready ( const Thread_Control the_thread)
static

Checks if the thread is ready.

Parameters
the_threadThe thread to check if it is ready.
Return values
trueThe thread is currently in the ready state.
falseThe thread is currently not ready.

Definition at line 401 of file threadimpl.h.

◆ _Thread_Iterate()

void _Thread_Iterate ( Thread_Visitor  visitor,
void *  arg 
)

Calls the visitor with all threads and the given argument until it is done.

Parameters
visitorFunction that gets a thread and arg as parameters and returns if it is done.
argParameter for visitor

Definition at line 21 of file threaditerate.c.

◆ _Thread_Join()

void _Thread_Join ( Thread_Control the_thread,
States_Control  waiting_for_join,
Thread_Control executing,
Thread_queue_Context queue_context 
)

Joins the currently executing thread with the given thread to wait for.

Parameters
[in,out]the_threadThe thread to wait for.
waiting_for_joinThe states control for the join.
[in,out]executingThe currently executing thread.
queue_contextThe thread queue context.

Definition at line 430 of file threadrestart.c.

◆ _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.

Definition at line 217 of file threadrestart.c.

◆ _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,out]the_threadThe pointer to the thread control block.

Definition at line 24 of file threadloadenv.c.

◆ _Thread_Pin()

static __inline__ void _Thread_Pin ( Thread_Control executing)
static

Pin the executing thread.

Parameters
executingThe currently executing thread.

Definition at line 2553 of file threadimpl.h.

◆ _Thread_Priority_add()

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.

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

Parameters
the_threadThe thread.
priority_nodeThe thread priority node to add.
queue_contextThe thread queue context to return an updated set of threads for _Thread_Priority_update(). The thread queue context must be initialized via _Thread_queue_Context_clear_priority_updates() before a call of this function.
See also
_Thread_Wait_acquire().

Definition at line 277 of file threadchangepriority.c.

◆ _Thread_Priority_and_sticky_update()

void _Thread_Priority_and_sticky_update ( Thread_Control the_thread,
int  sticky_level_change 
)

Updates the priority of the thread and changes it sticky level.

Parameters
the_threadThe thread.
sticky_level_changeThe new value for the sticky level.

Definition at line 362 of file threadchangepriority.c.

◆ _Thread_Priority_change()

static __inline__ void _Thread_Priority_change ( Thread_Control the_thread,
Priority_Node priority_node,
Priority_Control  new_priority,
bool  prepend_it,
Thread_queue_Context queue_context 
)
static

Changes the thread priority value of the specified thread priority node in the corresponding thread priority aggregation.

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

Parameters
the_threadThe thread.
[out]priority_nodeThe thread priority node to change.
new_priorityThe new thread priority value of the thread priority node to change.
prepend_itIn case this is true, then the thread is prepended to its priority group in its home scheduler instance, otherwise it is appended.
queue_contextThe thread queue context to return an updated set of threads for _Thread_Priority_update(). The thread queue context must be initialized via _Thread_queue_Context_clear_priority_updates() before a call of this function.
See also
_Thread_Wait_acquire().

Definition at line 722 of file threadimpl.h.

◆ _Thread_Priority_changed()

void _Thread_Priority_changed ( Thread_Control the_thread,
Priority_Node priority_node,
bool  prepend_it,
Thread_queue_Context queue_context 
)

Propagates a thread priority value change in the specified thread priority node to the corresponding thread priority aggregation.

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

Parameters
the_threadThe thread.
[out]priority_nodeThe thread priority node to change.
prepend_itIn case this is true, then the thread is prepended to its priority group in its home scheduler instance, otherwise it is appended.
queue_contextThe thread queue context to return an updated set of threads for _Thread_Priority_update(). The thread queue context must be initialized via _Thread_queue_Context_clear_priority_updates() before a call of this function.
See also
_Thread_Wait_acquire().

Definition at line 307 of file threadchangepriority.c.

◆ _Thread_Priority_highest()

static __inline__ Priority_Control _Thread_Priority_highest ( Priority_Control  left,
Priority_Control  right 
)
static

Returns the highest priority of the left and right thread priorities in the intuitive sense of priority.

Parameters
leftThe left thread priority.
rightThe right thread priority.
Returns
The highest priority in the intuitive sense of priority.

Definition at line 810 of file threadimpl.h.

◆ _Thread_Priority_less_than()

static __inline__ bool _Thread_Priority_less_than ( Priority_Control  left,
Priority_Control  right 
)
static

Checks if the left thread priority is less than the right thread priority in the intuitive sense of priority.

Parameters
leftThe left thread priority.
rightThe right thread priority.
Return values
trueThe left priority is less in the intuitive sense.
falseThe left priority is greater or equal in the intuitive sense.

Definition at line 793 of file threadimpl.h.

◆ _Thread_Priority_perform_actions()

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.

Parameters
the_threadThe thread for the verification.
Return values
trueThe thread is owner of the lock of the join queue.
falseThe thread is not owner of the lock of the join queue. Performs the priority actions specified by the thread queue context along the thread queue path.

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

Parameters
start_of_pathThe start thread of the thread queue path.
queue_contextThe thread queue context specifying the thread queue path and initial thread priority actions.
See also
_Thread_queue_Path_acquire_critical().

Definition at line 182 of file threadchangepriority.c.

◆ _Thread_Priority_remove()

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.

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

Parameters
the_threadThe thread.
priority_nodeThe thread priority node to remove.
queue_contextThe thread queue context to return an updated set of threads for _Thread_Priority_update(). The thread queue context must be initialized via _Thread_queue_Context_clear_priority_updates() before a call of this function.
See also
_Thread_Wait_acquire().

Definition at line 292 of file threadchangepriority.c.

◆ _Thread_Priority_replace()

void _Thread_Priority_replace ( Thread_Control the_thread,
Priority_Node victim_node,
Priority_Node replacement_node 
)

Replaces the victim priority node with the replacement priority node in the corresponding thread priority aggregation.

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

Parameters
the_threadThe thread.
victim_nodeThe victim thread priority node.
replacement_nodeThe replacement thread priority node.
See also
_Thread_Wait_acquire().

Definition at line 323 of file threadchangepriority.c.

◆ _Thread_Priority_update()

void _Thread_Priority_update ( Thread_queue_Context queue_context)

Updates the priority of all threads in the set.

Parameters
queue_contextThe thread queue context to return an updated set of threads for _Thread_Priority_update(). The thread queue context must be initialized via _Thread_queue_Context_clear_priority_updates() before a call of this function.
See also
_Thread_Priority_add(), _Thread_Priority_change(), _Thread_Priority_changed() and _Thread_Priority_remove().

Definition at line 339 of file threadchangepriority.c.

◆ _Thread_Remove_timer_and_unblock()

static __inline__ void _Thread_Remove_timer_and_unblock ( Thread_Control the_thread,
Thread_queue_Queue queue 
)
static

Remove the watchdog timer from the thread and unblock if necessary.

Parameters
[in,out]the_threadThe thread to remove the watchdog from and unblock if necessary.
queueThe thread queue.

Definition at line 2482 of file threadimpl.h.

◆ _Thread_Resource_count_decrement()

static __inline__ void _Thread_Resource_count_decrement ( Thread_Control the_thread)
static

Decrements the thread's resource count.

Parameters
[in,out]the_threadThe thread to decrement the resource count of.

Definition at line 1355 of file threadimpl.h.

◆ _Thread_Resource_count_increment()

static __inline__ void _Thread_Resource_count_increment ( Thread_Control the_thread)
static

Increments the thread's resource count.

Parameters
[in,out]the_threadThe thread to increase the resource count of.

Definition at line 1339 of file threadimpl.h.

◆ _Thread_Restart_other()

bool _Thread_Restart_other ( Thread_Control the_thread,
const Thread_Entry_information entry,
ISR_lock_Context lock_context 
)

Restarts the thread.

Parameters
[in,out]the_threadThe thread to restart.
entryThe start entry information for the_thread.
lock_contextThe lock context.
Return values
trueThe operation was successful.
falseThe operation failed.

Definition at line 568 of file threadrestart.c.

◆ _Thread_Restart_self()

void _Thread_Restart_self ( Thread_Control executing,
const Thread_Entry_information entry,
ISR_lock_Context lock_context 
)

Restarts the currently executing thread.

Parameters
[in,out]executingThe currently executing thread.
entryThe start entry information for executing.
lock_contextThe lock context.

Definition at line 611 of file threadrestart.c.

◆ _Thread_Restore_fp()

static __inline__ void _Thread_Restore_fp ( Thread_Control executing)
static

Restores the executing thread's floating point area.

Parameters
executingThe currently executing thread.

Definition at line 1029 of file threadimpl.h.

◆ _Thread_Save_fp()

static __inline__ void _Thread_Save_fp ( Thread_Control executing)
static

Checks if the floating point context of the thread is currently loaded in the floating point unit.

This function returns true if the floating point context of the_thread is currently loaded in the floating point unit, and false otherwise.

Parameters
the_threadThe thread for the verification.
Return values
trueThe floating point context of the_thread is currently loaded in the floating point unit.
falseThe floating point context of the_thread is currently not loaded in the floating point unit. Saves the executing thread's floating point area.
Parameters
executingThe currently executing thread.

Definition at line 1014 of file threadimpl.h.

◆ _Thread_Scheduler_acquire_critical()

static __inline__ void _Thread_Scheduler_acquire_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Acquires the lock context in a critical section.

Parameters
the_threadThe thread to acquire the lock context.
lock_contextThe lock context.

Definition at line 1483 of file threadimpl.h.

◆ _Thread_Scheduler_add_request()

static __inline__ void _Thread_Scheduler_add_request ( Thread_Control the_thread,
Scheduler_Node scheduler_node,
Scheduler_Node_request  request 
)
static

Add a scheduler request to the thread.

Parameters
[in,out]the_threadThe thread to add a scheduler request to.
[in,out]scheduler_nodeThe scheduler node for the request.
requestThe request to add.

Definition at line 1519 of file threadimpl.h.

◆ _Thread_Scheduler_add_wait_node()

static __inline__ void _Thread_Scheduler_add_wait_node ( Thread_Control the_thread,
Scheduler_Node scheduler_node 
)
static

Adds a wait node to the thread and adds a corresponding request to the thread.

Parameters
[in,out]the_threadThe thread to add the wait node to.
scheduler_nodeThe scheduler node which provides the wait node.

Definition at line 1562 of file threadimpl.h.

◆ _Thread_Scheduler_cancel_need_for_help()

static __inline__ void _Thread_Scheduler_cancel_need_for_help ( Thread_Control the_thread,
Per_CPU_Control cpu 
)
static

Cancels the thread's need for help.

Parameters
the_threadThe thread to cancel the help request of.
cpuThe cpu to get the lock context of in order to cancel the help request.

Definition at line 1394 of file threadimpl.h.

◆ _Thread_Scheduler_get_home()

static __inline__ const Scheduler_Control* _Thread_Scheduler_get_home ( const Thread_Control the_thread)
static

Gets the home scheduler of the thread.

Parameters
the_threadThe thread to get the home scheduler of.
Returns
The thread's home scheduler.

Definition at line 1419 of file threadimpl.h.

◆ _Thread_Scheduler_get_home_node()

static __inline__ Scheduler_Node* _Thread_Scheduler_get_home_node ( const Thread_Control the_thread)
static

Gets the scheduler's home node.

Parameters
the_threadThe thread to get the home node of.
Returns
The thread's home node.

Definition at line 1438 of file threadimpl.h.

◆ _Thread_Scheduler_get_node_by_index()

static __inline__ Scheduler_Node* _Thread_Scheduler_get_node_by_index ( const Thread_Control the_thread,
size_t  scheduler_index 
)
static

Gets the thread's scheduler node by index.

Parameters
the_threadThe thread of which to get a scheduler node.
scheduler_indexThe index of the desired scheduler node.
Returns
The scheduler node with the specified index.

Definition at line 1460 of file threadimpl.h.

◆ _Thread_Scheduler_process_requests()

void _Thread_Scheduler_process_requests ( Thread_Control the_thread)

Process the thread's scheduler requests.

Parameters
[in,out]the_threadThe thread for the operation.

Definition at line 23 of file threadscheduler.c.

◆ _Thread_Scheduler_release_critical()

static __inline__ void _Thread_Scheduler_release_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Releases the lock context in a critical section.

Parameters
the_threadThe thread to release the lock context.
lock_contextThe lock context.

Definition at line 1497 of file threadimpl.h.

◆ _Thread_Scheduler_remove_wait_node()

static __inline__ void _Thread_Scheduler_remove_wait_node ( Thread_Control the_thread,
Scheduler_Node scheduler_node 
)
static

Remove a wait node from the thread and add a corresponding request to it.

Parameters
the_threadThe thread to add the request to remove a wait node.
scheduler_nodeThe scheduler node to remove a wait node from.

Definition at line 1585 of file threadimpl.h.

◆ _Thread_Set_CPU()

static __inline__ void _Thread_Set_CPU ( Thread_Control thread,
Per_CPU_Control cpu 
)
static

Sets the cpu of the thread's scheduler.

Parameters
[out]threadThe thread.
cpuThe cpu to set.

Definition at line 886 of file threadimpl.h.

◆ _Thread_Set_life_protection()

Thread_Life_state _Thread_Set_life_protection ( Thread_Life_state  state)

Set the thread to life protected.

Calls _Thread_Change_life with the given state AND THREAD_LIFE_PROTECTED to set and THREAD_LIFE_PROTECTED to clear.

Parameters
stateThe states to set.
Returns
The previous state the thread was in.

Definition at line 680 of file threadrestart.c.

◆ _Thread_Set_name()

Status_Control _Thread_Set_name ( Thread_Control the_thread,
const char *  name 
)

Sets the name of the thread.

Parameters
[out]the_threadThe thread to change the name of.
nameThe new name for the thread.
Return values
STATUS_SUCCESSFULThe operation succeeded.
STATUS_RESULT_TOO_LARGEThe name was too long.

◆ _Thread_Set_state()

States_Control _Thread_Set_state ( Thread_Control the_thread,
States_Control  state 
)

Sets the specified thread state.

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

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

Definition at line 50 of file threadsetstate.c.

◆ _Thread_Set_state_locked()

States_Control _Thread_Set_state_locked ( Thread_Control the_thread,
States_Control  state 
)

Sets the specified thread state without locking the lock context.

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

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

Definition at line 28 of file threadsetstate.c.

◆ _Thread_Start()

bool _Thread_Start ( Thread_Control the_thread,
const Thread_Entry_information entry,
ISR_lock_Context lock_context 
)

Starts the specified thread.

If the thread is not in the dormant state, the routine returns with a value of false and performs no actions except enabling interrupts as indicated by the ISR lock context.

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

Then the routine enables the local interrupts as indicated by the ISR lock context.

Then the thread start user extensions are called with thread dispatching disabled and interrupts enabled after making the thread ready. Please note that in SMP configurations, the thread switch and begin user extensions may be called in parallel on another processor.

Then thread dispatching is enabled and other threads may execute before the routine returns.

Parameters
[in,out]the_threadis the thread to start.
entryis the thread entry information.
[in,out]isthe ISR lock context which shall be used to disable the local interrupts before the call of this routine.
Return values
trueThe thread was in the dormant state and was sucessefully started.
falseOtherwise.

Definition at line 26 of file threadstart.c.

◆ _Thread_Start_multitasking()

void _Thread_Start_multitasking ( void  )

Starts 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.

Definition at line 24 of file threadstartmultitasking.c.

◆ _Thread_State_acquire()

static __inline__ void _Thread_State_acquire ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Disables interrupts and acquires the lock_context.

Parameters
the_threadThe thread to acquire the lock context.
lock_contextThe lock context.

Definition at line 542 of file threadimpl.h.

◆ _Thread_State_acquire_critical()

static __inline__ void _Thread_State_acquire_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Acquires the lock context in a critical section.

Parameters
the_threadThe thread to acquire the lock context.
lock_contextThe lock context.

Definition at line 528 of file threadimpl.h.

◆ _Thread_State_acquire_for_executing()

static __inline__ Thread_Control* _Thread_State_acquire_for_executing ( ISR_lock_Context lock_context)
static

Disables interrupts and acquires the lock context for the currently executing thread.

Parameters
lock_contextThe lock context.
Returns
The currently executing thread.

Definition at line 559 of file threadimpl.h.

◆ _Thread_State_release()

static __inline__ void _Thread_State_release ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Releases the lock context and enables interrupts.

Parameters
[in,out]the_threadThe thread to release the lock context.
[out]lock_contextThe lock context.

Definition at line 592 of file threadimpl.h.

◆ _Thread_State_release_critical()

static __inline__ void _Thread_State_release_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Release the lock context in a critical section.

Parameters
the_threadThe thread to release the lock context.
lock_contextThe lock context.

Definition at line 578 of file threadimpl.h.

◆ _Thread_Timeout()

void _Thread_Timeout ( Watchdog_Control the_watchdog)

General purpose thread wait timeout.

Parameters
the_watchdogThe thread timer watchdog.

Definition at line 83 of file threadtimeout.c.

◆ _Thread_Timer_initialize()

static __inline__ void _Thread_Timer_initialize ( Thread_Timer_information timer,
Per_CPU_Control cpu 
)
static

Initializes the thread timer.

Parameters
[in,out]timerThe timer to initialize.
cpuThe cpu for the operation.

Definition at line 2388 of file threadimpl.h.

◆ _Thread_Timer_insert_realtime()

static __inline__ void _Thread_Timer_insert_realtime ( Thread_Control the_thread,
Per_CPU_Control cpu,
Watchdog_Service_routine_entry  routine,
uint64_t  expire 
)
static

Inserts the cpu's watchdog realtime into the thread's timer.

Parameters
[in,out]the_threadfor the operation.
cpuThe cpu to get the watchdog header from.
routineThe watchdog routine for the thread.
expireExpiration for the watchdog.

Definition at line 2431 of file threadimpl.h.

◆ _Thread_Timer_remove()

static __inline__ void _Thread_Timer_remove ( Thread_Control the_thread)
static

Remove the watchdog timer from the thread.

Parameters
[in,out]the_threadThe thread to remove the watchdog from.

Definition at line 2456 of file threadimpl.h.

◆ _Thread_Unblock()

static __inline__ void _Thread_Unblock ( Thread_Control the_thread)
static

Unblocks 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.

Parameters
[in,out]the_threadThe thread to unblock.

Definition at line 965 of file threadimpl.h.

◆ _Thread_Unpin()

static __inline__ void _Thread_Unpin ( Thread_Control executing,
Per_CPU_Control cpu_self 
)
static

Unpins the thread.

Parameters
executingThe currently executing thread.
cpu_selfThe cpu for the operation.

Definition at line 2570 of file threadimpl.h.

◆ _Thread_Update_CPU_time_used()

static __inline__ void _Thread_Update_CPU_time_used ( Thread_Control the_thread,
Per_CPU_Control cpu 
)
static

Updates the cpu time used of the thread.

Parameters
[in,out]the_threadThe thread to add additional cpu time that is used.
cpuThe cpu.

Definition at line 1155 of file threadimpl.h.

◆ _Thread_Wait_acquire()

static __inline__ void _Thread_Wait_acquire ( Thread_Control the_thread,
Thread_queue_Context queue_context 
)
static

Acquires the thread wait default lock and disables interrupts.

Parameters
[in,out]the_threadThe thread.
[in,out]queue_contextThe thread queue context for the corresponding _Thread_Wait_release().

Definition at line 1868 of file threadimpl.h.

◆ _Thread_Wait_acquire_critical()

static __inline__ void _Thread_Wait_acquire_critical ( Thread_Control the_thread,
Thread_queue_Context queue_context 
)
static

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

Parameters
[in,out]the_threadThe thread.
[in,out]queue_contextThe thread queue context for the corresponding _Thread_Wait_release_critical().

Definition at line 1812 of file threadimpl.h.

◆ _Thread_Wait_acquire_default()

static __inline__ void _Thread_Wait_acquire_default ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Acquires the thread wait default lock and disables interrupts.

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

Definition at line 1699 of file threadimpl.h.

◆ _Thread_Wait_acquire_default_critical()

static __inline__ void _Thread_Wait_acquire_default_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

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

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

Definition at line 1658 of file threadimpl.h.

◆ _Thread_Wait_acquire_default_for_executing()

static __inline__ Thread_Control* _Thread_Wait_acquire_default_for_executing ( ISR_lock_Context lock_context)
static

Acquires the thread wait default lock and returns the executing thread.

Parameters
lock_contextThe lock context used for the corresponding lock release.
Returns
The executing thread.
See also
_Thread_Wait_release_default().

Definition at line 1677 of file threadimpl.h.

◆ _Thread_Wait_acquire_queue_critical()

static __inline__ void _Thread_Wait_acquire_queue_critical ( Thread_queue_Queue queue,
Thread_queue_Lock_context queue_lock_context 
)
static

Acquires the wait queue inside a critical section.

Parameters
queueThe queue that acquires.
queue_lock_contextThe queue lock context.

Definition at line 1774 of file threadimpl.h.

◆ _Thread_Wait_cancel()

static __inline__ void _Thread_Wait_cancel ( Thread_Control the_thread,
Thread_queue_Context queue_context 
)
static

Cancels a thread wait on a thread queue.

Parameters
[in,out]the_threadThe thread.
queue_contextThe thread queue context used for corresponding _Thread_Wait_acquire().

Definition at line 2106 of file threadimpl.h.

◆ _Thread_Wait_claim()

static __inline__ void _Thread_Wait_claim ( Thread_Control the_thread,
Thread_queue_Queue queue 
)
static

Claims the thread wait queue.

The caller must not be the owner of the default thread wait lock. The caller must be the owner of the corresponding thread queue lock. The registration of the corresponding thread queue operations is deferred and done after the deadlock detection. This is crucial to support timeouts on SMP configurations.

Parameters
[in,out]the_threadThe thread.
[in,out]queueThe new thread queue.
See also
_Thread_Wait_claim_finalize() and _Thread_Wait_restore_default().

Definition at line 1952 of file threadimpl.h.

◆ _Thread_Wait_claim_finalize()

static __inline__ void _Thread_Wait_claim_finalize ( Thread_Control the_thread,
const Thread_queue_Operations operations 
)
static

Finalizes the thread wait queue claim via registration of the corresponding thread queue operations.

Parameters
[in,out]the_threadThe thread.
operationsThe corresponding thread queue operations.

Definition at line 1981 of file threadimpl.h.

◆ _Thread_Wait_flags_get()

static __inline__ Thread_Wait_flags _Thread_Wait_flags_get ( const Thread_Control the_thread)
static

Gets the thread's wait flags according to the ATOMIC_ORDER_RELAXED.

Parameters
the_threadThe thread to get the wait flags of.
Returns
The thread's wait flags.

Definition at line 2215 of file threadimpl.h.

◆ _Thread_Wait_flags_get_acquire()

static __inline__ Thread_Wait_flags _Thread_Wait_flags_get_acquire ( const Thread_Control the_thread)
static

Gets the thread's wait flags according to the ATOMIC_ORDER_ACQUIRE.

Parameters
the_threadThe thread to get the wait flags of.
Returns
The thread's wait flags.

Definition at line 2233 of file threadimpl.h.

◆ _Thread_Wait_flags_set()

static __inline__ void _Thread_Wait_flags_set ( Thread_Control the_thread,
Thread_Wait_flags  flags 
)
static

Sets the thread's wait flags.

Parameters
[in,out]the_threadThe thread to set the wait flags of.
flagsThe flags to set.

Definition at line 2196 of file threadimpl.h.

◆ _Thread_Wait_flags_try_change_acquire()

static __inline__ bool _Thread_Wait_flags_try_change_acquire ( Thread_Control the_thread,
Thread_Wait_flags  expected_flags,
Thread_Wait_flags  desired_flags 
)
static

Tries to change the thread wait flags with acquire semantics.

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

Parameters
the_threadThe thread.
expected_flagsThe expected wait flags.
desired_flagsThe desired wait flags.
Return values
trueThe wait flags were equal to the expected wait flags.
falseThe wait flags were not equal to the expected wait flags.

Definition at line 2300 of file threadimpl.h.

◆ _Thread_Wait_flags_try_change_release()

static __inline__ bool _Thread_Wait_flags_try_change_release ( Thread_Control the_thread,
Thread_Wait_flags  expected_flags,
Thread_Wait_flags  desired_flags 
)
static

Tries to change the thread wait flags with release semantics in case of success.

Must be called 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
the_threadThe thread.
expected_flagsThe expected wait flags.
desired_flagsThe desired wait flags.
Return values
trueThe wait flags were equal to the expected wait flags.
falseThe wait flags were not equal to the expected wait flags.

Definition at line 2260 of file threadimpl.h.

◆ _Thread_Wait_get_id()

Objects_Id _Thread_Wait_get_id ( const Thread_Control the_thread)

Returns the object identifier of the object containing the current thread wait queue.

This function may be used for debug and system information purposes. The caller must be the owner of the thread lock.

Parameters
the_threadThe thread.
Return values
0The thread waits on no thread queue currently, the thread wait queue is not contained in an object, or the current thread state provides insufficient information, e.g. the thread is in the middle of a blocking operation.
otherThe object identifier of the object containing the thread wait queue.

◆ _Thread_Wait_get_status()

static __inline__ Status_Control _Thread_Wait_get_status ( const Thread_Control the_thread)
static

Get the status of the wait return code of the thread.

Parameters
the_threadThe thread to get the status of the wait return code of.

Definition at line 2354 of file threadimpl.h.

◆ _Thread_Wait_release()

static __inline__ void _Thread_Wait_release ( Thread_Control the_thread,
Thread_queue_Context queue_context 
)
static

Releases the thread wait lock and restores the previous interrupt status.

Parameters
[in,out]the_threadThe thread.
[in,out]queue_contextThe thread queue context used for corresponding _Thread_Wait_acquire().

Definition at line 1929 of file threadimpl.h.

◆ _Thread_Wait_release_critical()

static __inline__ void _Thread_Wait_release_critical ( Thread_Control the_thread,
Thread_queue_Context queue_context 
)
static

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

The previous interrupt status is not restored.

Parameters
[in,out]the_threadThe thread.
[in,out]queue_contextThe thread queue context used for corresponding _Thread_Wait_acquire_critical().

Definition at line 1887 of file threadimpl.h.

◆ _Thread_Wait_release_default()

static __inline__ void _Thread_Wait_release_default ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

Releases the thread wait default lock and restores the previous interrupt status.

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

Definition at line 1734 of file threadimpl.h.

◆ _Thread_Wait_release_default_critical()

static __inline__ void _Thread_Wait_release_default_critical ( Thread_Control the_thread,
ISR_lock_Context lock_context 
)
static

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

The previous interrupt status is not restored.

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

Definition at line 1718 of file threadimpl.h.

◆ _Thread_Wait_release_queue_critical()

static __inline__ void _Thread_Wait_release_queue_critical ( Thread_queue_Queue queue,
Thread_queue_Lock_context queue_lock_context 
)
static

Releases the wait queue inside a critical section.

Parameters
queueThe queue that releases.
queue_lock_contextThe queue lock context.

Definition at line 1792 of file threadimpl.h.

◆ _Thread_Wait_remove_request()

static __inline__ void _Thread_Wait_remove_request ( Thread_Control the_thread,
Thread_queue_Lock_context queue_lock_context 
)
static

Removes a thread wait lock request.

On SMP configurations, removes a thread wait lock request.

On other configurations, this function does nothing.

Parameters
[in,out]the_threadThe thread.
[in,out]queue_lock_contextThe thread queue lock context used for corresponding _Thread_Wait_acquire().

Definition at line 2000 of file threadimpl.h.

◆ _Thread_Wait_remove_request_locked()

static __inline__ void _Thread_Wait_remove_request_locked ( Thread_Control the_thread,
Thread_queue_Lock_context queue_lock_context 
)
static

Removes the first pending wait lock request.

Parameters
the_threadThe thread to remove the request from.
queue_lock_contextThe queue lock context.

Definition at line 1753 of file threadimpl.h.

◆ _Thread_Wait_restore_default()

static __inline__ void _Thread_Wait_restore_default ( Thread_Control the_thread)
static

Restores the default thread wait queue and operations.

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

On SMP configurations, the pending requests are updated to use the stale thread queue operations.

Parameters
[in,out]the_threadThe thread.
See also
_Thread_Wait_claim().

Definition at line 2029 of file threadimpl.h.

◆ _Thread_Wait_tranquilize()

static __inline__ void _Thread_Wait_tranquilize ( Thread_Control the_thread)
static

Tranquilizes the thread after a wait on a thread queue.

After the violent blocking procedure this function makes the thread calm and peaceful again so that it can carry out its normal work.

On SMP configurations, ensures that all pending thread wait lock requests completed before the thread is able to begin a new thread wait procedure.

On other configurations, this function does nothing.

It must be called after a _Thread_Wait_claim() exactly once

  • after the corresponding thread queue lock was released, and
  • the default wait state is restored or some other processor is about to do this.
Parameters
the_threadThe thread.

Definition at line 2088 of file threadimpl.h.

◆ _Thread_Yield()

void _Thread_Yield ( Thread_Control executing)

Yields the currently executing thread.

Parameters
[in,out]executingThe thread that performs a yield.

Definition at line 30 of file threadyield.c.

◆ rtems_iterate_over_all_threads()

void rtems_iterate_over_all_threads ( rtems_per_thread_routine  routine)

Deprecated, use rtems_task_iterate() instead.

Use rtems_task_iterate() instead.

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, 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.

◆ _Thread_Global_constructor

Objects_Id _Thread_Global_constructor

Object identifier of the global constructor thread.

This variable is set by _RTEMS_tasks_Initialize_user_tasks_body() or _POSIX_Threads_Initialize_user_threads_body().

It is consumed by _Thread_Handler().

Definition at line 53 of file threadhandler.c.

◆ _Thread_Idle_body

const Thread_Idle_body _Thread_Idle_body

The idle thread body.

This constant is defined by the application configuration via <rtems/confdefs.h>.

Definition at line 35 of file threadidledefault.c.

◆ _Thread_Idle_stack_size

const size_t _Thread_Idle_stack_size

The idle thread stack size in bytes.

This constant is defined by the application configuration via <rtems/confdefs.h>.

◆ _Thread_Idle_stacks

char _Thread_Idle_stacks[]

The idle thread stacks.

Provided by the application via <rtems/confdefs.h>.

◆ _Thread_Initial_thread_count

const size_t _Thread_Initial_thread_count

Count of configured threads.

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

◆ _Thread_Maximum_name_size

const size_t _Thread_Maximum_name_size

Maximum size of a thread name in characters (including the terminating '\0' character).

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

◆ _Thread_Maximum_TLS_size

const size_t _Thread_Maximum_TLS_size

If this constant is greater than zero, then it defines the maximum thread-local storage size, otherwise the thread-local storage size is defined by the linker depending on the thread-local storage objects used by the application in the statically-linked executable.

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

◆ _Thread_queue_Heads_size

const size_t _Thread_queue_Heads_size

Size of the thread queue heads of a particular application.

In SMP configurations, this value is provided via <rtems/confdefs.h>.

◆ rtems_ada_self

void* rtems_ada_self

Self for the GNU Ada Run-Time