summaryrefslogtreecommitdiffstats
path: root/cpukit
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-19 17:43:36 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2014-08-20 08:17:49 +0200
commitbba3507723041f451c9da1ecee43819bcbe57f23 (patch)
tree6436d16e2edd96dc3807f0667d2b44bb4faecd44 /cpukit
parentrtems_termios_puts: Copy and write more than one char at once (diff)
downloadrtems-bba3507723041f451c9da1ecee43819bcbe57f23.tar.bz2
score: PR2179: Fix initially locked PI mutex
Diffstat (limited to 'cpukit')
-rw-r--r--cpukit/score/src/coremutex.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c
index e13c7aafac..949aa703ba 100644
--- a/cpukit/score/src/coremutex.c
+++ b/cpukit/score/src/coremutex.c
@@ -39,10 +39,14 @@ CORE_mutex_Status _CORE_mutex_Initialize(
the_mutex->Attributes = *the_mutex_attributes;
if ( initially_locked ) {
+ bool is_priority_ceiling =
+ _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes );
+
the_mutex->nest_count = 1;
the_mutex->holder = executing;
- if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
- _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
+
+ if ( is_priority_ceiling ||
+ _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ) {
Priority_Control ceiling = the_mutex->Attributes.priority_ceiling;
/*
@@ -52,7 +56,7 @@ CORE_mutex_Status _CORE_mutex_Initialize(
*/
_Thread_Disable_dispatch();
- if ( executing->current_priority < ceiling ) {
+ if ( is_priority_ceiling && executing->current_priority < ceiling ) {
_Thread_Enable_dispatch();
return CORE_MUTEX_STATUS_CEILING_VIOLATED;
}
@@ -65,7 +69,10 @@ CORE_mutex_Status _CORE_mutex_Initialize(
executing->resource_count++;
- _Thread_Change_priority( executing, ceiling, false );
+ if ( is_priority_ceiling ) {
+ _Thread_Change_priority( executing, ceiling, false );
+ }
+
_Thread_Enable_dispatch();
}
} else {