RTEMS
Classes | Macros | Typedefs | Functions | Variables
threadimpl.h File Reference

Inlined Routines from the Thread Handler. More...

#include <rtems/score/thread.h>
#include <rtems/score/assert.h>
#include <rtems/score/chainimpl.h>
#include <rtems/score/interr.h>
#include <rtems/score/isr.h>
#include <rtems/score/objectimpl.h>
#include <rtems/score/schedulernodeimpl.h>
#include <rtems/score/statesimpl.h>
#include <rtems/score/status.h>
#include <rtems/score/sysstate.h>
#include <rtems/score/timestampimpl.h>
#include <rtems/score/threadqimpl.h>
#include <rtems/score/todimpl.h>
#include <rtems/score/watchdogimpl.h>
#include <rtems/config.h>

Go to the source code of this file.

Classes

struct  Thread_Configuration
 The configuration of a new thread to initialize. More...
 
struct  Thread_Close_context
 

Macros

#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 bool(* Thread_Visitor) (Thread_Control *the_thread, void *arg)
 

Functions

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

void * rtems_ada_self
 
Objects_Id _Thread_Global_constructor
 Object identifier of the global constructor thread. More...
 

Detailed Description

Inlined Routines from the Thread Handler.

This file contains the macro implementation of the inlined routines from the Thread handler.

Definition in file threadimpl.h.