18 #ifndef _RTEMS_SCORE_COREMUTEXIMPL_H 19 #define _RTEMS_SCORE_COREMUTEXIMPL_H 60 #if defined(RTEMS_POSIX_API) 64 CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED,
80 #if defined(__RTEMS_STRICT_ORDER_MUTEX__) 84 CORE_MUTEX_RELEASE_NOT_ORDER,
99 #define CORE_MUTEX_STATUS_LAST CORE_MUTEX_STATUS_CEILING_VIOLATED 117 Thread_Control *executing,
119 bool initially_locked
124 _Thread_queue_Destroy( &the_mutex->
Wait_queue );
150 Thread_Control *executing,
154 #if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__) 169 Thread_Control *executing,
181 #define _CORE_mutex_Seize_interrupt_trylock( _mutex, _executing, _lock_context ) \ 182 _CORE_mutex_Seize_interrupt_trylock_body( _mutex, _executing, _lock_context ) 199 Thread_Control *executing,
213 #define _CORE_mutex_Check_dispatch_for_seize(_wait) \ 214 (!_Thread_Dispatch_is_enabled() \ 216 && (_System_state_Get() >= SYSTEM_STATE_UP)) 247 Thread_Control *executing,
258 INTERNAL_ERROR_MUTEX_OBTAIN_FROM_BAD_STATE
261 _Thread_queue_Acquire_critical( &the_mutex->
Wait_queue, lock_context );
264 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
290 #if defined(__RTEMS_DO_NOT_INLINE_CORE_MUTEX_SEIZE__) 293 Thread_Control *_executing,
300 #define _CORE_mutex_Seize( \ 301 _the_mutex, _executing, _id, _wait, _timeout, _lock_context ) \ 302 _CORE_mutex_Seize_body( \ 303 _the_mutex, _executing, _id, _wait, _timeout, _lock_context ) 361 return the_mutex->
holder != NULL;
448 Thread_Control *executing,
456 the_mutex->
holder = executing;
461 #ifdef __RTEMS_STRICT_ORDER_MUTEX__ 463 &the_mutex->queue.lock_queue );
471 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
484 if ( current == ceiling ) {
485 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
489 if ( current > ceiling ) {
493 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
503 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
519 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
521 #if defined(RTEMS_POSIX_API) 522 case CORE_MUTEX_NESTING_IS_ERROR:
524 _Thread_queue_Release( &the_mutex->
Wait_queue, lock_context );
CORE_mutex_Nesting_behaviors lock_nesting_behavior
This field determines what the behavior of this mutex instance will be when attempting to acquire the...
Definition: coremutex.h:109
RTEMS_INLINE_ROUTINE void _CORE_mutex_Seize_body(CORE_mutex_Control *the_mutex, Thread_Control *executing, Objects_Id id, bool wait, Watchdog_Interval timeout, ISR_lock_Context *lock_context)
Attempt to obtain the mutex.
Definition: coremuteximpl.h:245
This status indicates that the operation completed successfully.
Definition: coremuteximpl.h:54
Priority_Control current_priority
This field is the current priority state of this thread.
Definition: thread.h:683
Thread_queue_Control Wait_queue
This field is the Waiting Queue used to manage the set of tasks which are blocked waiting to lock the...
Definition: coremutex.h:153
void(* CORE_mutex_API_mp_support_callout)(Thread_Control *, Objects_Id)
Callout which provides to support global/multiprocessor operations.
Definition: coremuteximpl.h:42
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority(CORE_mutex_Attributes *the_attribute)
Doex core mutex use priority blocking.
Definition: coremuteximpl.h:394
Errors of the core system.
Definition: interr.h:51
#define RTEMS_INLINE_ROUTINE
The following (in conjunction with compiler arguments) are used to choose between the use of static i...
Definition: basedefs.h:135
This specifies that threads will wait for the mutex in priority order.
Definition: coremutex.h:53
RTEMS_INLINE_ROUTINE void _Thread_Dispatch_enable(Per_CPU_Control *cpu_self)
Enables thread dispatching.
Definition: threaddispatch.h:304
RTEMS_INLINE_ROUTINE bool _Thread_Is_executing(const Thread_Control *the_thread)
This function returns true if the_thread is the currently executing thread, and false otherwise...
Definition: threadimpl.h:517
void _Terminate(Internal_errors_Source the_source, bool is_internal, Internal_errors_t the_error)
Initiates system termination.
Definition: interr.c:31
Priority_Control priority_ceiling
This field contains the ceiling priority to be used if that protocol is selected. ...
Definition: coremutex.h:121
This specifies that threads will wait for the mutex in FIFO order.
Definition: coremutex.h:51
#define _CORE_mutex_Seize_interrupt_trylock(_mutex, _executing, _lock_context)
The default is to favor speed and inlining this definitely saves a few instructions.
Definition: coremuteximpl.h:181
uint32_t nest_count
This element contains the number of times the mutex has been acquired nested.
Definition: coremutex.h:161
RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body(CORE_mutex_Control *the_mutex, Thread_Control *executing, ISR_lock_Context *lock_context)
Attempt to receive a unit from the_mutex.
Definition: coremuteximpl.h:446
void _Thread_Raise_priority(Thread_Control *the_thread, Priority_Control new_priority)
Raises the priority of a thread.
Definition: threadchangepriority.c:99
CORE_mutex_Status _CORE_mutex_Surrender(CORE_mutex_Control *the_mutex, Objects_Id id, CORE_mutex_API_mp_support_callout api_mutex_mp_support, ISR_lock_Context *lock_context)
Frees a unit to the mutex.
Definition: coremutexsurrender.c:88
This specifies that threads will wait for the mutex in priority order.
Definition: coremutex.h:61
uint32_t Priority_Control
The following type defines the control block used to manage thread priorities.
Definition: priority.h:56
CORE_mutex_Status
The possible Mutex handler return statuses.
Definition: coremuteximpl.h:52
This structure defines the Thread Control Block (TCB).
Definition: thread.h:671
Per CPU Core Structure.
Definition: percpu.h:233
This status indicates that a thread of logically greater importance than the ceiling priority attempt...
Definition: coremuteximpl.h:90
This status indicates that the thread was blocked waiting for an operation to complete and the mutex ...
Definition: coremuteximpl.h:73
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_priority_ceiling(CORE_mutex_Attributes *the_attribute)
Does mutex use priority ceiling.
Definition: coremuteximpl.h:430
uint32_t resource_count
This field is the number of mutexes currently held by this thread.
Definition: thread.h:713
Constants and Structures Associated with the Manipulation of Objects.
#define _CORE_mutex_Check_dispatch_for_seize(_wait)
Verifies that a mutex blocking seize is performed safely.
Definition: coremuteximpl.h:213
CORE_mutex_Status _CORE_mutex_Initialize(CORE_mutex_Control *the_mutex, Thread_Control *executing, const CORE_mutex_Attributes *the_mutex_attributes, bool initially_locked)
Initializes the mutex based on the parameters passed.
Definition: coremutex.c:26
void _CORE_mutex_Seize_interrupt_blocking(CORE_mutex_Control *the_mutex, Thread_Control *executing, Watchdog_Interval timeout, ISR_lock_Context *lock_context)
Performs the blocking portion of a mutex obtain.
Definition: coremutexseize.c:48
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_inherit_priority(CORE_mutex_Attributes *the_attribute)
Does mutex use priority inheritance.
Definition: coremuteximpl.h:412
This status indicates that the calling task did not want to block and the operation was unable to com...
Definition: coremuteximpl.h:59
This status indicates that the calling task was willing to block but the operation was unable to comp...
Definition: coremuteximpl.h:78
This specifies that threads will wait for the mutex in priority order.
Definition: coremutex.h:57
uint32_t Watchdog_Interval
Type is used to specify the length of intervals.
Definition: watchdog.h:47
Control block used to manage each mutex.
Definition: coremutex.h:149
System State Handler API.
This sequence performs as indicated:
Definition: coremutex.h:96
This sequence has no blocking or errors:
Definition: coremutex.h:79
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_fifo(const CORE_mutex_Attributes *the_attribute)
Does core mutex use FIFO blocking.
Definition: coremuteximpl.h:375
This status indicates that an attempt was made to release a mutex by a thread other than the thread w...
Definition: coremuteximpl.h:69
Inlined Routines from the Thread Handler.
RTEMS_INLINE_ROUTINE bool _CORE_mutex_Is_locked(const CORE_mutex_Control *the_mutex)
Is mutex locked.
Definition: coremuteximpl.h:357
RTEMS_INLINE_ROUTINE Per_CPU_Control * _Thread_Dispatch_disable_critical(const ISR_lock_Context *lock_context)
Disables thread dispatching inside a critical section (interrupts disabled).
Definition: threaddispatch.h:251
Thread_Control * holder
This element points to the thread which is currently holding this mutex.
Definition: coremutex.h:166
Local ISR lock context for acquire and release pairs.
Definition: isrlock.h:65
The control block used to manage attributes of each mutex.
Definition: coremutex.h:105
CORE_mutex_Attributes Attributes
This element is the set of attributes which define this instance's behavior.
Definition: coremutex.h:157
#define _CORE_mutex_Seize(_the_mutex, _executing, _id, _wait, _timeout, _lock_context)
This method is used to obtain a core mutex.
Definition: coremuteximpl.h:300
uint32_t Objects_Id
The following type defines the control block used to manage object IDs.
Definition: object.h:122
CORE_mutex_Disciplines discipline
This field indicates whether threads waiting on the mutex block in FIFO or priority order...
Definition: coremutex.h:117
Thread_Wait_information Wait
This field is the blocking information for this thread.
Definition: thread.h:715
RTEMS_INLINE_ROUTINE void _Chain_Prepend_unprotected(Chain_Control *the_chain, Chain_Node *the_node)
Prepend a node (unprotected).
Definition: chainimpl.h:787
void(* Thread_queue_Flush_callout)(Thread_Control *)
The following type defines the callout used when a remote task is extracted from a local thread queue...
Definition: threadqimpl.h:65
void _CORE_mutex_Flush(CORE_mutex_Control *the_mutex, Thread_queue_Flush_callout remote_extract_callout, uint32_t status)
Flush all waiting threads.
Definition: coremutexflush.c:26