From 5a598ac99b0de720a04afc5e2ac6764117589b90 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 27 May 2016 08:02:03 +0200 Subject: score: Add CORE mutex variants Add CORE_recursive_mutex_Control and CORE_ceiling_mutex_Control to avoid the run-time evaluation of attributes to figure out how a particular mutex methods should behave. Start with the no protocol variants. This eliminates the CORE_MUTEX_DISCIPLINES_FIFO and CORE_MUTEX_DISCIPLINES_PRIORITY disciplines. --- cpukit/posix/include/rtems/posix/muteximpl.h | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'cpukit/posix/include/rtems/posix/muteximpl.h') diff --git a/cpukit/posix/include/rtems/posix/muteximpl.h b/cpukit/posix/include/rtems/posix/muteximpl.h index 30cc19da7e..4957e207fb 100644 --- a/cpukit/posix/include/rtems/posix/muteximpl.h +++ b/cpukit/posix/include/rtems/posix/muteximpl.h @@ -28,6 +28,19 @@ extern "C" { #endif +#define POSIX_MUTEX_NO_PROTOCOL_TQ_OPERATIONS &_Thread_queue_Operations_FIFO + +/** + * @brief Supported POSIX mutex protocols. + * + * Must be in synchronization with POSIX_Mutex_Control::protocol. + */ +typedef enum { + POSIX_MUTEX_NO_PROTOCOL, + POSIX_MUTEX_PRIORITY_INHERIT, + POSIX_MUTEX_PRIORITY_CEILING +} POSIX_Mutex_Protocol; + /** * The following defines the information control block used to manage * this class of objects. @@ -39,6 +52,28 @@ extern Objects_Information _POSIX_Mutex_Information; */ extern pthread_mutexattr_t _POSIX_Mutex_Default_attributes; +RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Acquire_critical( + POSIX_Mutex_Control *the_mutex, + Thread_queue_Context *queue_context +) +{ + _CORE_mutex_Acquire_critical( + &the_mutex->Mutex.Recursive.Mutex, + queue_context + ); +} + +RTEMS_INLINE_ROUTINE void _POSIX_Mutex_Release( + POSIX_Mutex_Control *the_mutex, + Thread_queue_Context *queue_context +) +{ + _CORE_mutex_Release( + &the_mutex->Mutex.Recursive.Mutex, + queue_context + ); +} + /** * @brief POSIX Mutex Allocate * -- cgit v1.2.3