RTEMS
5.1
|
Mutex Handler. More...
Files | |
file | coremutex.h |
CORE Mutex API. | |
file | coremuteximpl.h |
CORE Mutex Implementation. | |
file | coremutexseize.c |
Seize Mutex with Blocking. | |
Data Structures | |
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 |
Mutex Handler.
This handler encapsulates functionality which provides the foundation Mutex services used in all of the APIs supported by RTEMS.
RTEMS_INLINE_ROUTINE Priority_Control _CORE_ceiling_mutex_Get_priority | ( | const CORE_ceiling_mutex_Control * | the_mutex | ) |
Gets the priority of the ceiling mutex.
the_mutex | The mutex to get the priority from. |
RTEMS_INLINE_ROUTINE const Scheduler_Control* _CORE_ceiling_mutex_Get_scheduler | ( | const CORE_ceiling_mutex_Control * | the_mutex | ) |
Gets the scheduler of the ceiling mutex.
the_mutex | The ceiling mutex to get the scheduler from. |
RTEMS_INLINE_ROUTINE void _CORE_ceiling_mutex_Initialize | ( | CORE_ceiling_mutex_Control * | the_mutex, |
const Scheduler_Control * | scheduler, | ||
Priority_Control | priority_ceiling | ||
) |
initializes a ceiling mutex.
[out] | the_mutex | The ceiling mutex to initialize. |
scheduler | The scheduler for the new ceiling mutex. Only needed if RTEMS_SMP is defined | |
priority_ceiling | The priority ceiling for the initialized mutex. |
RTEMS_INLINE_ROUTINE 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 | ||
) |
Seizes the ceiling mutex.
[in,out] | the_mutex | The mutex to seize. |
executing | The executing thread. | |
wait | Indicates whether the calling thread is willing to wait. | |
nested | Function that returns the status of the recursive mutex | |
queue_context | The thread queue context. |
STATUS_SUCCESSFUL | The owner of the mutex was changed successfully. |
STATUS_NOT_DEFINED | If the scheduler of the executing thread is not equal to the owner of the_mutex . |
STATUS_MUTEX_CEILING_VIOLATED | The owners wait priority is smaller than the priority of the ceiling mutex. |
other | Return value of nested. |
RTEMS_INLINE_ROUTINE 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.
[in,out] | the_mutex | The mutex to set the owner of. |
owner | The new owner of the_mutex. | |
queue_context | The thread queue context. |
STATUS_SUCCESSFUL | The owner of the mutex was changed successfully. |
STATUS_MUTEX_CEILING_VIOLATED | The owners wait priority is smaller than the priority of the ceiling mutex. |
RTEMS_INLINE_ROUTINE 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.
[out] | the_mutex | The ceiling mutex to set the priority of. |
priority_ceiling | The new priority ceiling of the mutex. | |
queue_context | The thread queue context. |
RTEMS_INLINE_ROUTINE Status_Control _CORE_ceiling_mutex_Surrender | ( | CORE_ceiling_mutex_Control * | the_mutex, |
Thread_Control * | executing, | ||
Thread_queue_Context * | queue_context | ||
) |
Surrenders the ceiling mutex.
[in,out] | the_mutex | The ceiling mutex to surrender. |
executing | The executing thread. | |
queue_context | The thread queue context. |
STATUS_SUCCESSFUL | The ceiling mutex was successfullysurrendered. |
STATUS_NOT_OWNER | The executing thread is not the owner of the_mutex. |
RTEMS_INLINE_ROUTINE void _CORE_mutex_Acquire_critical | ( | CORE_mutex_Control * | the_mutex, |
Thread_queue_Context * | queue_context | ||
) |
Acquires the mutex critical.
[in,out] | the_mutex | The mutex to acquire critical. |
queue_context | The queue context. |
RTEMS_INLINE_ROUTINE void _CORE_mutex_Destroy | ( | CORE_mutex_Control * | the_mutex | ) |
Destroys the mutex.
[out] | the_mutex | the mutex to destroy. |
RTEMS_INLINE_ROUTINE Thread_Control* _CORE_mutex_Get_owner | ( | const CORE_mutex_Control * | the_mutex | ) |
Gets the owner of the mutex.
the_mutex | The mutex to get the owner from. |
RTEMS_INLINE_ROUTINE void _CORE_mutex_Initialize | ( | CORE_mutex_Control * | the_mutex | ) |
Initializes the mutex.
[out] | the_mutex | The mutex to initialize. |
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_locked | ( | const CORE_mutex_Control * | the_mutex | ) |
Checks if the mutex is locked.
This routine returns true if the specified mutex is locked and false otherwise.
the_mutex | The mutex to check if it is locked. |
true | The mutex is locked. |
false | The mutex is not locked. |
RTEMS_INLINE_ROUTINE 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.
the_mutex | The mutex to check the owner of. |
the_thread | The thread to check if it is the owner of the_mutex. |
true | the_thread is the owner of the_mutex. |
false | the_thread is not the owner of the_mutex. |
RTEMS_INLINE_ROUTINE void _CORE_mutex_Release | ( | CORE_mutex_Control * | the_mutex, |
Thread_queue_Context * | queue_context | ||
) |
Releases the mutex.
[in,out] | the_mutex | The mutex to release. |
queue_context | The queue context. |
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.
[in,out] | the_mutex | The mutex to seize. |
operations | The thread queue operations. | |
executing | The calling thread. | |
wait | Indicates whether the calling thread is willing to wait. | |
queue_context | The thread queue context. |
_Thread_Wait_get_status | The status of the executing thread. |
STATUS_UNAVAILABLE | The calling thread is not willing to wait. |
RTEMS_INLINE_ROUTINE void _CORE_mutex_Set_owner | ( | CORE_mutex_Control * | the_mutex, |
Thread_Control * | owner | ||
) |
Sets the owner of the mutex.
[out] | the_mutex | The mutex to set the owner from. |
owner | The new owner of the mutex. |
RTEMS_INLINE_ROUTINE void _CORE_recursive_mutex_Initialize | ( | CORE_recursive_mutex_Control * | the_mutex | ) |
Initializes a recursive mutex.
[out] | the_mutex | The recursive mutex to initialize. |
RTEMS_INLINE_ROUTINE 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 | ||
) |
Seizes the recursive mutex.
[in,out] | the_mutex | The recursive mutex to seize. |
operations | The thread queue operations. | |
[out] | executing | The executing thread. |
wait | Indicates whether the calling thread is willing to wait. | |
nested | Returns the status of a recursive mutex. | |
queue_context | The thread queue context. |
STATUS_SUCCESSFUL | The owner of the mutex was NULL, successful seizing of the mutex. |
_Thread_Wait_get_status | The status of the executing thread. |
STATUS_UNAVAILABLE | The calling thread is not willing to wait. |
RTEMS_INLINE_ROUTINE Status_Control _CORE_recursive_mutex_Seize_nested | ( | CORE_recursive_mutex_Control * | the_mutex | ) |
Seizes the recursive mutex nested.
[out] | the_mutex | The recursive mutex to seize nested. |
RTEMS_INLINE_ROUTINE 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.
[in,out] | the_mutex | The recursive mutex to surrender. |
operations | The thread queue operations. | |
executing | The executing thread. | |
queue_context | the thread queue context. |
STATUS_SUCCESSFUL | the_mutex is successfully surrendered. |
STATUS_NOT_OWNER | The executing thread does not own the_mutex. |