18 #ifndef _RTEMS_SCORE_COREMUTEXIMPL_H 19 #define _RTEMS_SCORE_COREMUTEXIMPL_H 24 #include <rtems/score/status.h> 38 #define CORE_MUTEX_TQ_OPERATIONS &_Thread_queue_Operations_priority 40 #define CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS \ 41 &_Thread_queue_Operations_priority_inherit 201 return STATUS_SUCCESSFUL;
234 if ( owner == NULL ) {
238 return STATUS_SUCCESSFUL;
241 if ( owner == executing ) {
242 Status_Control status;
244 status = ( *nested )( the_mutex );
276 unsigned int nest_level;
283 return STATUS_NOT_OWNER;
288 if ( nest_level > 0 ) {
291 return STATUS_SUCCESSFUL;
299 if ( heads == NULL ) {
301 return STATUS_SUCCESSFUL;
311 return STATUS_SUCCESSFUL;
330 #if defined(RTEMS_SMP) 347 #if defined(RTEMS_SMP) 371 if ( owner != NULL ) {
431 return STATUS_MUTEX_CEILING_VIOLATED;
447 return STATUS_SUCCESSFUL;
479 if ( owner == NULL ) {
480 #if defined(RTEMS_SMP) 486 return STATUS_NOT_DEFINED;
498 if ( owner == executing ) {
499 Status_Control status;
501 status = ( *nested )( &the_mutex->
Recursive );
508 CORE_MUTEX_TQ_OPERATIONS,
531 unsigned int nest_level;
540 return STATUS_NOT_OWNER;
545 if ( nest_level > 0 ) {
548 return STATUS_SUCCESSFUL;
564 CORE_MUTEX_TQ_OPERATIONS
572 if ( new_owner != NULL ) {
573 #if defined(RTEMS_MULTIPROCESSING) 587 CORE_MUTEX_TQ_OPERATIONS,
597 return STATUS_SUCCESSFUL;
static __inline__ void _Thread_queue_Acquire_critical(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Acquires the thread queue control in a critical section.
Priority_Node Priority_ceiling
The priority ceiling node for the mutex owner.
Thread_Control * owner
The thread queue owner.
static __inline__ Thread_Control * _Thread_queue_First_locked(Thread_queue_Control *the_thread_queue, const Thread_queue_Operations *operations)
Returns the first thread on the thread queue if it exists, otherwise NULL.
static __inline__ bool _Objects_Is_local_id(Objects_Id id RTEMS_UNUSED)
Checks if the id is of a local object.
uint64_t Priority_Control
The thread priority control.
Thread_queue_Control Wait_queue
The thread queue of this mutex.
static __inline__ void _CORE_ceiling_mutex_Set_priority(CORE_ceiling_mutex_Control *the_mutex, Priority_Control priority_ceiling, Thread_queue_Context *queue_context)
Sets the priority of the ceiling mutex.
static __inline__ Per_CPU_Control * _Thread_queue_Dispatch_disable(Thread_queue_Context *queue_context)
Disables dispatching in a critical section.
Thread queue context for the thread queue methods.
unsigned int nest_level
The nest level in case of a recursive seize.
static __inline__ const Scheduler_Control * _Thread_Scheduler_get_home(const Thread_Control *the_thread)
Gets the home scheduler of the thread.
static __inline__ bool _CORE_mutex_Is_locked(const CORE_mutex_Control *the_mutex)
Checks if the mutex is locked.
static __inline__ void _CORE_mutex_Set_owner(CORE_mutex_Control *the_mutex, Thread_Control *owner)
Sets the owner of the mutex.
static __inline__ void _Thread_Resource_count_increment(Thread_Control *the_thread)
Increments the thread's resource count.
CORE_recursive_mutex_Control Recursive
The plain recursive mutex.
Inlined Routines Associated with the Manipulation of the Scheduler.
static __inline__ Status_Control _CORE_recursive_mutex_Seize_nested(CORE_recursive_mutex_Control *the_mutex)
Seizes the recursive mutex nested.
Priority_Control priority
The priority value of this node.
const struct _Scheduler_Control * scheduler
The scheduler instance for this priority ceiling mutex.
static __inline__ const Scheduler_Control * _CORE_ceiling_mutex_Get_scheduler(const CORE_ceiling_mutex_Control *the_mutex)
Gets the scheduler of the ceiling mutex.
static __inline__ Status_Control _CORE_ceiling_mutex_Seize(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *executing, bool wait, Status_Control(*nested)(CORE_recursive_mutex_Control *), Thread_queue_Context *queue_context)
Seizes the ceiling mutex.
static __inline__ Status_Control _CORE_ceiling_mutex_Set_owner(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *owner, Thread_queue_Context *queue_context)
Sets the owner of the ceiling mutex.
static __inline__ void _Thread_Resource_count_decrement(Thread_Control *the_thread)
Decrements the thread's resource count.
void _Thread_queue_Object_initialize(Thread_queue_Control *the_thread_queue)
Initializes a thread queue embedded in an object with identifier.
Thread_queue_Queue Queue
The actual thread queue.
Thread_queue_Heads * heads
The thread queue heads.
static __inline__ Per_CPU_Control * _Thread_Dispatch_disable_critical(const ISR_lock_Context *lock_context)
Disables thread dispatching inside a critical section (interrupts disabled).
static __inline__ Status_Control _CORE_ceiling_mutex_Surrender(CORE_ceiling_mutex_Control *the_mutex, Thread_Control *executing, Thread_queue_Context *queue_context)
Surrenders the ceiling mutex.
static __inline__ Scheduler_Node * _Thread_Scheduler_get_home_node(const Thread_Control *the_thread)
Gets the scheduler's home node.
static __inline__ void _Thread_Wait_acquire(Thread_Control *the_thread, Thread_queue_Context *queue_context)
Acquires the thread wait default lock and disables interrupts.
Thread_queue_Lock_context Lock_context
The lock context for the thread queue acquire and release operations.
CORE_mutex_Control Mutex
The plain non-recursive mutex.
static __inline__ Thread_Control * _CORE_mutex_Get_owner(const CORE_mutex_Control *the_mutex)
Gets the owner of the mutex.
Constants and Structures Associated with the Manipulation of Objects.
static __inline__ Priority_Control _CORE_ceiling_mutex_Get_priority(const CORE_ceiling_mutex_Control *the_mutex)
Gets the priority of the ceiling mutex.
static __inline__ void _CORE_ceiling_mutex_Initialize(CORE_ceiling_mutex_Control *the_mutex, const Scheduler_Control *scheduler, Priority_Control priority_ceiling)
initializes a ceiling mutex.
void _Thread_queue_Surrender(Thread_queue_Queue *queue, Thread_queue_Heads *heads, Thread_Control *previous_owner, Thread_queue_Context *queue_context, const Thread_queue_Operations *operations)
Surrenders the thread queue previously owned by the thread to the first enqueued thread.
const Scheduler_Control _Scheduler_Table[]
This table contains the configured schedulers.
void _Thread_Priority_update(Thread_queue_Context *queue_context)
Updates the priority of all threads in the set.
static __inline__ Status_Control _CORE_recursive_mutex_Seize(CORE_recursive_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Status_Control(*nested)(CORE_recursive_mutex_Control *), Thread_queue_Context *queue_context)
Seizes the recursive mutex.
void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
static __inline__ void _Thread_queue_Context_clear_priority_updates(Thread_queue_Context *queue_context)
Clears the priority update count of the thread queue context.
The recursive mutex control.
struct Scheduler_Node::@20 Wait
Thread wait support block.
static __inline__ void _CORE_mutex_Release(CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
Releases the mutex.
Control block used to manage each mutex.
Scheduler node for per-thread data.
Inlined Routines from the Thread Handler.
static __inline__ void _CORE_mutex_Acquire_critical(CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
Acquires the mutex critical.
static __inline__ Priority_Control _Priority_Get_priority(const Priority_Aggregation *aggregation)
Gets the priority aggregation's priority.
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...
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).
static __inline__ void _CORE_mutex_Initialize(CORE_mutex_Control *the_mutex)
Initializes the mutex.
The recursive mutex control with priority ceiling protocol support.
Local ISR lock context for acquire and release pairs.
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.
static __inline__ bool _CORE_mutex_Is_owner(const CORE_mutex_Control *the_mutex, const Thread_Control *the_thread)
Checks if the the thread is the owner of the mutex.
ISR_lock_Context Lock_context
The lock context for the thread queue acquire and release operations.
static __inline__ void _Thread_queue_Destroy(Thread_queue_Control *the_thread_queue)
Destroys the thread queue.
#define RTEMS_INLINE_ROUTINE
Gives a hint to the compiler in a function declaration to inline this function.
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).
void _Thread_queue_Release(Thread_queue_Control *the_thread_queue, Thread_queue_Context *queue_context)
Releases the thread queue control and enables interrupts.
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.
static __inline__ void _CORE_mutex_Destroy(CORE_mutex_Control *the_mutex)
Destroys the mutex.
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 p...
void _Thread_queue_Extract_critical(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Extracts the thread from the thread queue and unblocks it.
static __inline__ void _CORE_recursive_mutex_Initialize(CORE_recursive_mutex_Control *the_mutex)
Initializes a recursive mutex.
static __inline__ void _Priority_Node_initialize(Priority_Node *node, Priority_Control priority)
Initializes the priority node to the given priority.
Status_Control _CORE_mutex_Seize_slow(CORE_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Seize the mutex slowly.
static __inline__ Status_Control _CORE_recursive_mutex_Surrender(CORE_recursive_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, Thread_queue_Context *queue_context)
Surrenders the recursive mutex.