summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-27 11:10:42 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-05-30 16:16:22 +0200
commitdbd65507a2fa452a1df3718d3b467dc8a6171358 (patch)
tree1a7cafc6dc1783cff48d62bf2a81275be682b22c
parente0bb60bc81cc89988005261fcdfbc7f6f451e0c9 (diff)
posix: Avoid use of internal mutex methods
Avoid use of internal mutex methods for pthread_mutex_setprioceiling().
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index 09554f84c4..20f14dc1f6 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -33,7 +33,7 @@ int pthread_mutex_setprioceiling(
{
register POSIX_Mutex_Control *the_mutex;
Priority_Control the_priority;
- Thread_queue_Context queue_context;
+ int error;
if ( !old_ceiling )
return EINVAL;
@@ -47,33 +47,22 @@ int pthread_mutex_setprioceiling(
* Must acquire the mutex before we can change it's ceiling.
* POSIX says block until we acquire it.
*/
- (void) pthread_mutex_lock( mutex );
-
- /*
- * Do not worry about the return code from this. The Get operation
- * will also fail if it is a bad id or was deleted between the two
- * operations.
- *
- * NOTE: This makes it easier to get 100% binary coverage since the
- * bad Id case is handled by the switch.
- */
- the_mutex = _POSIX_Mutex_Get( mutex, &queue_context );
-
- if ( the_mutex == NULL ) {
+ error = pthread_mutex_lock( mutex );
+ if ( error != 0 ) {
+ _Assert( error == EINVAL );
return EINVAL;
}
+ the_mutex = _POSIX_Mutex_Get_no_protection( mutex );
+ _Assert( the_mutex != NULL );
+
*old_ceiling = _POSIX_Priority_From_core(
the_mutex->Mutex.Attributes.priority_ceiling
);
the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
- /*
- * We are required to unlock the mutex before we return.
- */
- _CORE_mutex_Surrender(
- &the_mutex->Mutex,
- &queue_context
- );
+ error = pthread_mutex_unlock( mutex );
+ _Assert( error == 0 );
+ (void) error;
return 0;
}