From fd84982c0019205ea5e4c226f47dd62480cfd5e6 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 21 Dec 2007 15:50:09 +0000 Subject: 2007-12-21 Xi Yang * configure.ac, score/include/rtems/score/coremutex.h, score/include/rtems/score/thread.h, score/inline/rtems/score/coremutex.inl, score/src/coremutexsurrender.c, score/src/threadinitialize.c: Add support for proper stacking of priority inheritance on mutexes as well as enforce proper order of release. --- cpukit/score/inline/rtems/score/coremutex.inl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'cpukit/score/inline') diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl index 342428ccbb..9311cd11a5 100644 --- a/cpukit/score/inline/rtems/score/coremutex.inl +++ b/cpukit/score/inline/rtems/score/coremutex.inl @@ -101,7 +101,6 @@ RTEMS_INLINE_ROUTINE boolean _CORE_mutex_Is_inherit_priority( * PRIORITY_CEILING and FALSE otherwise. * * @param[in] the_attribute is the attribute set of the mutex - * * @return This method returns TRUE if the mutex is using priority * ceiling. */ @@ -120,7 +119,8 @@ RTEMS_INLINE_ROUTINE boolean _CORE_mutex_Is_priority_ceiling( * * NOTE: The Doxygen for this routine is in the .h file. */ -RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock( + +RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock_body( CORE_mutex_Control *the_mutex, ISR_Level *level_p ) @@ -138,8 +138,16 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock( the_mutex->holder_id = executing->Object.id; the_mutex->nest_count = 1; if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) || - _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) + _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ){ + +#ifdef __STRICT_ORDER_MUTEX__ + _Chain_Prepend_unprotected(&executing->lock_mutex,&the_mutex->queue.lock_queue); + the_mutex->queue.priority_before = executing->current_priority; +#endif + executing->resource_count++; + } + if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) { _ISR_Enable( level ); return 0; -- cgit v1.2.3