summaryrefslogtreecommitdiffstats
path: root/cpukit/score/inline/rtems/score/coremutex.inl
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-03-05 21:01:40 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-03-05 21:01:40 +0000
commit96d0b64c620a2107a5d6b076a17ab26fca6b2a39 (patch)
tree1abb8637b91640982eff0d1d3a4f64e624182cca /cpukit/score/inline/rtems/score/coremutex.inl
parent2007-03-05 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-96d0b64c620a2107a5d6b076a17ab26fca6b2a39.tar.bz2
2007-03-05 Joel Sherrill <joel@OARcorp.com>
PR 1222/cpukit * score/Makefile.am, score/include/rtems/score/coremutex.h, score/include/rtems/score/threadq.h, score/inline/rtems/score/coremutex.inl, score/src/coremsgsubmit.c, score/src/coremutexsurrender.c, score/src/threadchangepriority.c, score/src/threadclearstate.c, score/src/threadhandler.c, score/src/threadinitialize.c, score/src/threadqdequeuefifo.c, score/src/threadqdequeuepriority.c, score/src/threadqenqueue.c, score/src/threadqenqueuefifo.c, score/src/threadqenqueuepriority.c, score/src/threadqextractfifo.c, score/src/threadqextractpriority.c, score/src/threadsetstate.c: Enhance so that when the prioirity of a thread that is blocked on a priority based thread queue is changed, that its placement in the queue is reevaluated based upon the new priority. This enhancement includes modifications to the SuperCore as well as new test cases. * score/src/threadqrequeue.c: New file.
Diffstat (limited to 'cpukit/score/inline/rtems/score/coremutex.inl')
-rw-r--r--cpukit/score/inline/rtems/score/coremutex.inl37
1 files changed, 25 insertions, 12 deletions
diff --git a/cpukit/score/inline/rtems/score/coremutex.inl b/cpukit/score/inline/rtems/score/coremutex.inl
index 2bde4a888f..342428ccbb 100644
--- a/cpukit/score/inline/rtems/score/coremutex.inl
+++ b/cpukit/score/inline/rtems/score/coremutex.inl
@@ -143,25 +143,29 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
if ( !_CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
_ISR_Enable( level );
return 0;
- }
- /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING */
+ } /* else must be CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING
+ *
+ * we possibly bump the priority of the current holder -- which
+ * happens to be _Thread_Executing.
+ */
{
- Priority_Control ceiling;
- Priority_Control current;
+ Priority_Control ceiling;
+ Priority_Control current;
+
+ ceiling = the_mutex->Attributes.priority_ceiling;
+ current = executing->current_priority;
+ if ( current == ceiling ) {
+ _ISR_Enable( level );
+ return 0;
+ }
- ceiling = the_mutex->Attributes.priority_ceiling;
- current = executing->current_priority;
- if ( current == ceiling ) {
- _ISR_Enable( level );
- return 0;
- }
- if ( current > ceiling ) {
+ if ( current > ceiling ) {
_Thread_Disable_dispatch();
_ISR_Enable( level );
_Thread_Change_priority(
the_mutex->holder,
the_mutex->Attributes.priority_ceiling,
- FALSE
+ FALSE
);
_Thread_Enable_dispatch();
return 0;
@@ -177,6 +181,11 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
return 0;
}
+ /*
+ * At this point, we know the mutex was not available. If this thread
+ * is the thread that has locked the mutex, let's see if we are allowed
+ * to nest access.
+ */
if ( _Thread_Is_executing( the_mutex->holder ) ) {
switch ( the_mutex->Attributes.lock_nesting_behavior ) {
case CORE_MUTEX_NESTING_ACQUIRES:
@@ -192,6 +201,10 @@ RTEMS_INLINE_ROUTINE int _CORE_mutex_Seize_interrupt_trylock(
}
}
+ /*
+ * The mutex is not available and the caller must deal with the possibility
+ * of blocking.
+ */
return 1;
}