From 272a80b776b862d5432338b39e1e4bcaf74ad4b2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 22 May 2014 09:31:13 +0200 Subject: score: PR2179: Fix initially locked PCP mutexes Elevate the priority of the creating task to the ceiling priority in case a semaphore is created as initially locked. --- cpukit/score/src/coremutex.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'cpukit') diff --git a/cpukit/score/src/coremutex.c b/cpukit/score/src/coremutex.c index dcd2e778fe..9745f82b7e 100644 --- a/cpukit/score/src/coremutex.c +++ b/cpukit/score/src/coremutex.c @@ -64,9 +64,9 @@ CORE_mutex_Status _CORE_mutex_Initialize( the_mutex->holder_id = _Thread_Executing->Object.id; if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { + Priority_Control ceiling = the_mutex->Attributes.priority_ceiling; - if ( _Thread_Executing->current_priority < - the_mutex->Attributes.priority_ceiling ) + if ( _Thread_Executing->current_priority < ceiling ) return CORE_MUTEX_STATUS_CEILING_VIOLATED; #ifdef __RTEMS_STRICT_ORDER_MUTEX__ _Chain_Prepend_unprotected( &_Thread_Executing->lock_mutex, @@ -75,6 +75,7 @@ CORE_mutex_Status _CORE_mutex_Initialize( #endif _Thread_Executing->resource_count++; + _Thread_Change_priority( _Thread_Executing, ceiling, false ); } } else { the_mutex->nest_count = 0; -- cgit v1.2.3