Changeset cc757fe in rtems


Ignore:
Timestamp:
08/07/96 20:57:28 (27 years ago)
Author:
Mark Johannes <Mark.Johannes@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
a14684c3
Parents:
c123a084
Message:

_CORE_Mutex_seize: added checks for priority ceiling violation, also added

checks to ensure priority was not lowered.

Files:
2 edited

Legend:

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

    rc123a084 rcc757fe  
    111111
    112112  executing = _Thread_Executing;
     113  switch ( the_mutex->Attributes.discipline ) {
     114    case CORE_MUTEX_DISCIPLINES_FIFO:
     115    case CORE_MUTEX_DISCIPLINES_PRIORITY:
     116    case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     117      break;
     118    case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     119      if ( executing->current_priority <
     120                              the_mutex->Attributes.priority_ceiling) {
     121        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
     122        return;
     123      }
     124  }
    113125  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
    114126  _ISR_Disable( level );
     
    124136      case CORE_MUTEX_DISCIPLINES_PRIORITY:
    125137      case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     138        /* already the highest priority */
    126139        break;
    127140      case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     141      if ( the_mutex->Attributes.priority_ceiling <
     142                                           executing->current_priority ) {
    128143        _Thread_Change_priority(
    129           executing,
     144          the_mutex->holder,
    130145          the_mutex->Attributes.priority_ceiling
    131146        );
    132         break;
     147      }
    133148    }
    134149    return;
     
    181196        break;
    182197      case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
    183         _Thread_Change_priority(
    184           executing,
    185           the_mutex->Attributes.priority_ceiling
    186         );
     198        if ( the_mutex->Attributes.priority_ceiling <
     199                                           executing->current_priority ) {
     200          _Thread_Change_priority(
     201            executing,
     202            the_mutex->Attributes.priority_ceiling
     203          );
     204        };
    187205        break;
    188206    }
  • cpukit/score/src/coremutex.c

    rc123a084 rcc757fe  
    111111
    112112  executing = _Thread_Executing;
     113  switch ( the_mutex->Attributes.discipline ) {
     114    case CORE_MUTEX_DISCIPLINES_FIFO:
     115    case CORE_MUTEX_DISCIPLINES_PRIORITY:
     116    case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     117      break;
     118    case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     119      if ( executing->current_priority <
     120                              the_mutex->Attributes.priority_ceiling) {
     121        executing->Wait.return_code = CORE_MUTEX_STATUS_CEILING_VIOLATED;
     122        return;
     123      }
     124  }
    113125  executing->Wait.return_code = CORE_MUTEX_STATUS_SUCCESSFUL;
    114126  _ISR_Disable( level );
     
    124136      case CORE_MUTEX_DISCIPLINES_PRIORITY:
    125137      case CORE_MUTEX_DISCIPLINES_PRIORITY_INHERIT:
     138        /* already the highest priority */
    126139        break;
    127140      case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
     141      if ( the_mutex->Attributes.priority_ceiling <
     142                                           executing->current_priority ) {
    128143        _Thread_Change_priority(
    129           executing,
     144          the_mutex->holder,
    130145          the_mutex->Attributes.priority_ceiling
    131146        );
    132         break;
     147      }
    133148    }
    134149    return;
     
    181196        break;
    182197      case CORE_MUTEX_DISCIPLINES_PRIORITY_CEILING:
    183         _Thread_Change_priority(
    184           executing,
    185           the_mutex->Attributes.priority_ceiling
    186         );
     198        if ( the_mutex->Attributes.priority_ceiling <
     199                                           executing->current_priority ) {
     200          _Thread_Change_priority(
     201            executing,
     202            the_mutex->Attributes.priority_ceiling
     203          );
     204        };
    187205        break;
    188206    }
Note: See TracChangeset for help on using the changeset viewer.