summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mutexsetprioceiling.c
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-14 15:57:54 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2016-06-22 14:00:28 +0200
commit5a32c486f9b7bd8687af253931b47d7abb091bc3 (patch)
tree31f97524b91bb123eb316b00e8056e5d62cf5200 /cpukit/posix/src/mutexsetprioceiling.c
parentposix: Rework sporadic server scheduling policy (diff)
downloadrtems-5a32c486f9b7bd8687af253931b47d7abb091bc3.tar.bz2
posix: Make POSIX API aware of scheduler instances
Diffstat (limited to 'cpukit/posix/src/mutexsetprioceiling.c')
-rw-r--r--cpukit/posix/src/mutexsetprioceiling.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/cpukit/posix/src/mutexsetprioceiling.c b/cpukit/posix/src/mutexsetprioceiling.c
index 96e8dbfeba..65b93c7a56 100644
--- a/cpukit/posix/src/mutexsetprioceiling.c
+++ b/cpukit/posix/src/mutexsetprioceiling.c
@@ -31,18 +31,14 @@ int pthread_mutex_setprioceiling(
int *old_ceiling
)
{
- register POSIX_Mutex_Control *the_mutex;
- Priority_Control the_priority;
- int error;
+ POSIX_Mutex_Control *the_mutex;
+ const Scheduler_Control *scheduler;
+ int error;
+ int unlock_error;
if ( !old_ceiling )
return EINVAL;
- if ( !_POSIX_Priority_Is_valid( prioceiling ) )
- return EINVAL;
-
- the_priority = _POSIX_Priority_To_core( prioceiling );
-
/*
* Must acquire the mutex before we can change it's ceiling.
* POSIX says block until we acquire it.
@@ -56,13 +52,26 @@ int pthread_mutex_setprioceiling(
the_mutex = _POSIX_Mutex_Get_no_protection( mutex );
_Assert( the_mutex != NULL );
+ scheduler = &_Scheduler_Table[ 0 ];
+
*old_ceiling = _POSIX_Priority_From_core(
+ scheduler,
the_mutex->Mutex.priority_ceiling
);
- the_mutex->Mutex.priority_ceiling = the_priority;
- error = pthread_mutex_unlock( mutex );
- _Assert( error == 0 );
- (void) error;
- return 0;
+ if ( _POSIX_Priority_Is_valid( scheduler, prioceiling ) ) {
+ Priority_Control priority;
+
+ priority = _POSIX_Priority_To_core( scheduler, prioceiling );
+ the_mutex->Mutex.priority_ceiling = priority;
+
+ error = 0;
+ } else {
+ error = EINVAL;
+ }
+
+ unlock_error = pthread_mutex_unlock( mutex );
+ _Assert( unlock_error == 0 );
+ (void) unlock_error;
+ return error;
}