Ignore:
Timestamp:
Aug 30, 2001, 6:32:12 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
b68cc333
Parents:
ca739de3
Message:

2001-08-30 Joel Sherrill <joel@…>

  • src/coremutex.c, src/coremutexseize.c, src/coremutexsurrender.c: The per thread field resource_count should only be manipulated when a mutex is priority ceiling or priority inherit. This was reported by Chris Johns <ccj@…> who also noticed that the use of switches for all disciplines generated less efficient code than using explicit tests for the one or two cases we were really interested in. Further review of his modifications made it apparent that the "isa" methods to test mutex discipline were not being used so this modification was swept into the code as well.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/exec/score/src/coremutexsurrender.c

    rca739de3 r6f1118a  
    8787  }
    8888
    89   holder->resource_count--;
     89  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
     90       _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) )
     91    holder->resource_count--;
    9092  the_mutex->holder    = NULL;
    9193  the_mutex->holder_id = 0;
     
    9799   */
    98100
    99   switch ( the_mutex->Attributes.discipline ) {
    100     case CORE_MUTEX_DISCIPLINES_FIFO:
    101     case CORE_MUTEX_DISCIPLINES_PRIORITY:
    102       break;
    103     case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
    104     case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
    105       if ( holder->resource_count == 0 &&
    106            holder->real_priority != holder->current_priority ) {
    107          _Thread_Change_priority( holder, holder->real_priority, TRUE );
    108       }
    109       break;
     101  if ( _CORE_mutex_Is_inherit_priority( &the_mutex->Attributes ) ||
     102       _CORE_mutex_Is_priority_ceiling( &the_mutex->Attributes ) ) {
     103    if ( holder->resource_count == 0 &&
     104         holder->real_priority != holder->current_priority ) {
     105       _Thread_Change_priority( holder, holder->real_priority, TRUE );
     106    }
    110107  }
    111 
    112108
    113109  if ( ( the_thread = _Thread_queue_Dequeue( &the_mutex->Wait_queue ) ) ) {
Note: See TracChangeset for help on using the changeset viewer.