summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-30 06:59:55 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-30 16:16:23 +0200
commit0b713f8940d90b480f8cd36663c11aa0688587d8 (patch)
treec71a01748c3749e0243518b486c2bb32a1c67df1 /cpukit/posix/src
parentscore: Rework CORE priority ceiling mutex (diff)
downloadrtems-0b713f8940d90b480f8cd36663c11aa0688587d8.tar.bz2
score: Rework CORE inherit priority mutex
Provide dedicated seize and surrender methods for inherit priority mutexes. This eliminates CORE_mutex_Attributes.
Diffstat (limited to 'cpukit/posix/src')
-rw-r--r--cpukit/posix/src/mutexinit.c43
-rw-r--r--cpukit/posix/src/mutexlocksupp.c5
-rw-r--r--cpukit/posix/src/mutexunlock.c5
3 files changed, 22 insertions, 31 deletions
diff --git a/cpukit/posix/src/mutexinit.c b/cpukit/posix/src/mutexinit.c
index 6c5705b20b..73f0544965 100644
--- a/cpukit/posix/src/mutexinit.c
+++ b/cpukit/posix/src/mutexinit.c
@@ -119,33 +119,22 @@ int pthread_mutex_init(
the_mutex->protocol = protocol;
the_mutex->is_recursive = ( the_attr->type == PTHREAD_MUTEX_RECURSIVE );
- if ( protocol == POSIX_MUTEX_PRIORITY_CEILING ) {
- _CORE_ceiling_mutex_Initialize(
- &the_mutex->Mutex,
- _POSIX_Priority_To_core( the_attr->prio_ceiling )
- );
- } else if ( protocol == POSIX_MUTEX_NO_PROTOCOL ) {
- _CORE_recursive_mutex_Initialize(
- &the_mutex->Mutex.Recursive
- );
- } else {
- CORE_mutex_Attributes the_mutex_attr;
-
- if ( the_attr->type == PTHREAD_MUTEX_RECURSIVE ) {
- the_mutex_attr.lock_nesting_behavior = CORE_MUTEX_NESTING_ACQUIRES;
- } else {
- the_mutex_attr.lock_nesting_behavior = CORE_MUTEX_NESTING_IS_ERROR;
- }
-
- /*
- * Must be initialized to unlocked.
- */
- _CORE_mutex_Initialize(
- &the_mutex->Mutex.Recursive.Mutex,
- NULL,
- &the_mutex_attr,
- false
- );
+ switch ( the_mutex->protocol ) {
+ case POSIX_MUTEX_PRIORITY_CEILING:
+ _CORE_ceiling_mutex_Initialize(
+ &the_mutex->Mutex,
+ _POSIX_Priority_To_core( the_attr->prio_ceiling )
+ );
+ break;
+ default:
+ _Assert(
+ the_mutex->protocol == POSIX_MUTEX_NO_PROTOCOL
+ || the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT
+ );
+ _CORE_recursive_mutex_Initialize(
+ &the_mutex->Mutex.Recursive
+ );
+ break;
}
_Objects_Open_u32( &_POSIX_Mutex_Information, &the_mutex->Object, 0 );
diff --git a/cpukit/posix/src/mutexlocksupp.c b/cpukit/posix/src/mutexlocksupp.c
index cccb2d31b3..d3d07f68e8 100644
--- a/cpukit/posix/src/mutexlocksupp.c
+++ b/cpukit/posix/src/mutexlocksupp.c
@@ -88,11 +88,12 @@ int _POSIX_Mutex_Lock_support(
break;
default:
_Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
- status = _CORE_mutex_Seize(
- &the_mutex->Mutex.Recursive.Mutex,
+ status = _CORE_recursive_mutex_Seize(
+ &the_mutex->Mutex.Recursive,
executing,
wait,
timeout,
+ _POSIX_Mutex_Lock_nested,
&queue_context
);
break;
diff --git a/cpukit/posix/src/mutexunlock.c b/cpukit/posix/src/mutexunlock.c
index 5404cef187..3144314e5c 100644
--- a/cpukit/posix/src/mutexunlock.c
+++ b/cpukit/posix/src/mutexunlock.c
@@ -62,8 +62,9 @@ int pthread_mutex_unlock(
break;
default:
_Assert( the_mutex->protocol == POSIX_MUTEX_PRIORITY_INHERIT );
- status = _CORE_mutex_Surrender(
- &the_mutex->Mutex.Recursive.Mutex,
+ status = _CORE_recursive_mutex_Surrender(
+ &the_mutex->Mutex.Recursive,
+ executing,
&queue_context
);
break;