RTEMS
Files | Classes | Macros | Functions
Mutex Handler

Mutex Handler. More...

Files

file  coremutex.h
 CORE Mutex API.
 
file  coremuteximpl.h
 CORE Mutex Implementation.
 
file  coremutexseize.c
 Seize Mutex with Blocking.
 

Classes

struct  CORE_mutex_Control
 Control block used to manage each mutex. More...
 
struct  CORE_recursive_mutex_Control
 The recursive mutex control. More...
 
struct  CORE_ceiling_mutex_Control
 The recursive mutex control with priority ceiling protocol support. More...
 

Macros

#define CORE_MUTEX_TQ_OPERATIONS   &_Thread_queue_Operations_priority
 
#define CORE_MUTEX_TQ_PRIORITY_INHERIT_OPERATIONS   &_Thread_queue_Operations_priority_inherit
 

Functions

static __inline__ void _CORE_mutex_Initialize (CORE_mutex_Control *the_mutex)
 Initializes the mutex. More...
 
static __inline__ void _CORE_mutex_Destroy (CORE_mutex_Control *the_mutex)
 Destroys the mutex. More...
 
static __inline__ void _CORE_mutex_Acquire_critical (CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
 Acquires the mutex critical. More...
 
static __inline__ void _CORE_mutex_Release (CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
 Releases the mutex. More...
 
static __inline__ Thread_Control_CORE_mutex_Get_owner (const CORE_mutex_Control *the_mutex)
 Gets the owner of the mutex. More...
 
static __inline__ bool _CORE_mutex_Is_locked (const CORE_mutex_Control *the_mutex)
 Checks if the mutex is locked. More...
 
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. More...
 
static __inline__ void _CORE_mutex_Set_owner (CORE_mutex_Control *the_mutex, Thread_Control *owner)
 Sets the owner of the mutex. More...
 
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. More...
 
static __inline__ void _CORE_recursive_mutex_Initialize (CORE_recursive_mutex_Control *the_mutex)
 Initializes a recursive mutex. More...
 
static __inline__ Status_Control _CORE_recursive_mutex_Seize_nested (CORE_recursive_mutex_Control *the_mutex)
 Seizes the recursive mutex nested. More...
 
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. More...
 
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. More...
 
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. More...
 
static __inline__ const Scheduler_Control_CORE_ceiling_mutex_Get_scheduler (const CORE_ceiling_mutex_Control *the_mutex)
 Gets the scheduler of the ceiling mutex. More...
 
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. More...
 
static __inline__ Priority_Control _CORE_ceiling_mutex_Get_priority (const CORE_ceiling_mutex_Control *the_mutex)
 Gets the priority of the ceiling mutex. More...
 
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. More...
 
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. More...
 
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. More...
 

Detailed Description

Mutex Handler.

This handler encapsulates functionality which provides the foundation Mutex services used in all of the APIs supported by RTEMS.

Function Documentation

◆ _CORE_ceiling_mutex_Get_priority()

static __inline__ Priority_Control _CORE_ceiling_mutex_Get_priority ( const CORE_ceiling_mutex_Control the_mutex)
static

Gets the priority of the ceiling mutex.

Parameters
the_mutexThe mutex to get the priority from.
Returns
The priority ceiling of the_mutex.

Definition at line 393 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Get_scheduler()

static __inline__ const Scheduler_Control* _CORE_ceiling_mutex_Get_scheduler ( const CORE_ceiling_mutex_Control the_mutex)
static

Gets the scheduler of the ceiling mutex.

Parameters
the_mutexThe ceiling mutex to get the scheduler from.
Returns
The scheduler of the mutex. If RTEMS_SMP is not defined, the first entry of the _Scheduler_Table is returned.

Definition at line 343 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Initialize()

static __inline__ void _CORE_ceiling_mutex_Initialize ( CORE_ceiling_mutex_Control the_mutex,
const Scheduler_Control scheduler,
Priority_Control  priority_ceiling 
)
static

initializes a ceiling mutex.

Parameters
[out]the_mutexThe ceiling mutex to initialize.
schedulerThe scheduler for the new ceiling mutex. Only needed if RTEMS_SMP is defined
priority_ceilingThe priority ceiling for the initialized mutex.

Definition at line 322 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Seize()

static __inline__ Status_Control _CORE_ceiling_mutex_Seize ( CORE_ceiling_mutex_Control the_mutex,
Thread_Control executing,
bool  wait,
Status_Control(*)(CORE_recursive_mutex_Control *)  nested,
Thread_queue_Context queue_context 
)
static

Seizes the ceiling mutex.

Parameters
[in,out]the_mutexThe mutex to seize.
executingThe executing thread.
waitIndicates whether the calling thread is willing to wait.
nestedFunction that returns the status of the recursive mutex
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe owner of the mutex was changed successfully.
STATUS_NOT_DEFINEDIf the scheduler of the executing thread is not equal to the owner of the_mutex .
STATUS_MUTEX_CEILING_VIOLATEDThe owners wait priority is smaller than the priority of the ceiling mutex.
otherReturn value of nested.

Definition at line 465 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Set_owner()

static __inline__ Status_Control _CORE_ceiling_mutex_Set_owner ( CORE_ceiling_mutex_Control the_mutex,
Thread_Control owner,
Thread_queue_Context queue_context 
)
static

Sets the owner of the ceiling mutex.

Parameters
[in,out]the_mutexThe mutex to set the owner of.
ownerThe new owner of the_mutex.
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe owner of the mutex was changed successfully.
STATUS_MUTEX_CEILING_VIOLATEDThe owners wait priority is smaller than the priority of the ceiling mutex.

Definition at line 411 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Set_priority()

static __inline__ void _CORE_ceiling_mutex_Set_priority ( CORE_ceiling_mutex_Control the_mutex,
Priority_Control  priority_ceiling,
Thread_queue_Context queue_context 
)
static

Sets the priority of the ceiling mutex.

Parameters
[out]the_mutexThe ceiling mutex to set the priority of.
priority_ceilingThe new priority ceiling of the mutex.
queue_contextThe thread queue context.

Definition at line 361 of file coremuteximpl.h.

◆ _CORE_ceiling_mutex_Surrender()

static __inline__ Status_Control _CORE_ceiling_mutex_Surrender ( CORE_ceiling_mutex_Control the_mutex,
Thread_Control executing,
Thread_queue_Context queue_context 
)
static

Surrenders the ceiling mutex.

Parameters
[in,out]the_mutexThe ceiling mutex to surrender.
executingThe executing thread.
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe ceiling mutex was successfullysurrendered.
STATUS_NOT_OWNERThe executing thread is not the owner of the_mutex.

Definition at line 525 of file coremuteximpl.h.

◆ _CORE_mutex_Acquire_critical()

static __inline__ void _CORE_mutex_Acquire_critical ( CORE_mutex_Control the_mutex,
Thread_queue_Context queue_context 
)
static

Acquires the mutex critical.

Parameters
[in,out]the_mutexThe mutex to acquire critical.
queue_contextThe queue context.

Definition at line 71 of file coremuteximpl.h.

◆ _CORE_mutex_Destroy()

static __inline__ void _CORE_mutex_Destroy ( CORE_mutex_Control the_mutex)
static

Destroys the mutex.

Parameters
[out]the_mutexthe mutex to destroy.

Definition at line 60 of file coremuteximpl.h.

◆ _CORE_mutex_Get_owner()

static __inline__ Thread_Control* _CORE_mutex_Get_owner ( const CORE_mutex_Control the_mutex)
static

Gets the owner of the mutex.

Parameters
the_mutexThe mutex to get the owner from.
Returns
The owner of the mutex.

Definition at line 100 of file coremuteximpl.h.

◆ _CORE_mutex_Initialize()

static __inline__ void _CORE_mutex_Initialize ( CORE_mutex_Control the_mutex)
static

Initializes the mutex.

Parameters
[out]the_mutexThe mutex to initialize.

Definition at line 48 of file coremuteximpl.h.

◆ _CORE_mutex_Is_locked()

static __inline__ bool _CORE_mutex_Is_locked ( const CORE_mutex_Control the_mutex)
static

Checks if the mutex is locked.

This routine returns true if the specified mutex is locked and false otherwise.

Parameters
the_mutexThe mutex to check if it is locked.
Return values
trueThe mutex is locked.
falseThe mutex is not locked.

Definition at line 118 of file coremuteximpl.h.

◆ _CORE_mutex_Is_owner()

static __inline__ bool _CORE_mutex_Is_owner ( const CORE_mutex_Control the_mutex,
const Thread_Control the_thread 
)
static

Checks if the the thread is the owner of the mutex.

Parameters
the_mutexThe mutex to check the owner of.
the_threadThe thread to check if it is the owner of the_mutex.
Return values
truethe_thread is the owner of the_mutex.
falsethe_thread is not the owner of the_mutex.

Definition at line 168 of file coremuteximpl.h.

◆ _CORE_mutex_Release()

static __inline__ void _CORE_mutex_Release ( CORE_mutex_Control the_mutex,
Thread_queue_Context queue_context 
)
static

Releases the mutex.

Parameters
[in,out]the_mutexThe mutex to release.
queue_contextThe queue context.

Definition at line 85 of file coremuteximpl.h.

◆ _CORE_mutex_Seize_slow()

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.

Parameters
[in,out]the_mutexThe mutex to seize.
operationsThe thread queue operations.
executingThe calling thread.
waitIndicates whether the calling thread is willing to wait.
queue_contextThe thread queue context.
Return values
_Thread_Wait_get_statusThe status of the executing thread.
STATUS_UNAVAILABLEThe calling thread is not willing to wait.

Definition at line 26 of file coremutexseize.c.

◆ _CORE_mutex_Set_owner()

static __inline__ void _CORE_mutex_Set_owner ( CORE_mutex_Control the_mutex,
Thread_Control owner 
)
static

Sets the owner of the mutex.

Parameters
[out]the_mutexThe mutex to set the owner from.
ownerThe new owner of the mutex.

Definition at line 151 of file coremuteximpl.h.

◆ _CORE_recursive_mutex_Initialize()

static __inline__ void _CORE_recursive_mutex_Initialize ( CORE_recursive_mutex_Control the_mutex)
static

Initializes a recursive mutex.

Parameters
[out]the_mutexThe recursive mutex to initialize.

Definition at line 181 of file coremuteximpl.h.

◆ _CORE_recursive_mutex_Seize()

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(*)(CORE_recursive_mutex_Control *)  nested,
Thread_queue_Context queue_context 
)
static

Seizes the recursive mutex.

Parameters
[in,out]the_mutexThe recursive mutex to seize.
operationsThe thread queue operations.
[out]executingThe executing thread.
waitIndicates whether the calling thread is willing to wait.
nestedReturns the status of a recursive mutex.
queue_contextThe thread queue context.
Return values
STATUS_SUCCESSFULThe owner of the mutex was NULL, successful seizing of the mutex.
_Thread_Wait_get_statusThe status of the executing thread.
STATUS_UNAVAILABLEThe calling thread is not willing to wait.

Definition at line 219 of file coremuteximpl.h.

◆ _CORE_recursive_mutex_Seize_nested()

static __inline__ Status_Control _CORE_recursive_mutex_Seize_nested ( CORE_recursive_mutex_Control the_mutex)
static

Seizes the recursive mutex nested.

Parameters
[out]the_mutexThe recursive mutex to seize nested.
Returns
STATUS_SUCCESSFUL, this method is always successful.

Definition at line 196 of file coremuteximpl.h.

◆ _CORE_recursive_mutex_Surrender()

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 
)
static

Surrenders the recursive mutex.

Parameters
[in,out]the_mutexThe recursive mutex to surrender.
operationsThe thread queue operations.
executingThe executing thread.
queue_contextthe thread queue context.
Return values
STATUS_SUCCESSFULthe_mutex is successfully surrendered.
STATUS_NOT_OWNERThe executing thread does not own the_mutex.

Definition at line 269 of file coremuteximpl.h.