Changeset 06f5ec9 in rtems


Ignore:
Timestamp:
Jul 7, 2009, 5:29:47 PM (10 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, master
Children:
fc267d1
Parents:
9a845e17
Message:

2009-07-07 Joel Sherrill <joel.sherrill@…>

  • posix/src/mutexsetprioceiling.c: Restructure to eliminate code paths which are unreachable. Also add more comments.
  • score/src/coremutexsurrender.c: Mark some code as RTEMS_DEBUG only since it cannot be hit unless coremutexseize.c is broken.
Location:
cpukit
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    r9a845e17 r06f5ec9  
     12009-07-07      Joel Sherrill <joel.sherrill@OARcorp.com>
     2
     3        * posix/src/mutexsetprioceiling.c: Restructure to eliminate code
     4        paths which are unreachable. Also add more comments.
     5        * score/src/coremutexsurrender.c: Mark some code as RTEMS_DEBUG only
     6        since it cannot be hit unless coremutexseize.c is broken.
     7
    182009-07-06      Joel Sherrill <joel.sherrill@OARcorp.com>
    29
  • cpukit/posix/src/mutexsetprioceiling.c

    r9a845e17 r06f5ec9  
    4949
    5050  /*
    51    *  Must acquire the mutex before we can change it's ceiling
     51   *  Must acquire the mutex before we can change it's ceiling.
     52   *  POSIX says block until we acquire it.
    5253   */
     54  (void) pthread_mutex_lock( mutex );
    5355
    54   status = pthread_mutex_lock( mutex );
    55   if ( status )
    56     return status;
    57 
     56  /*
     57   *  Do not worry about the return code from this.  The Get operation
     58   *  will also fail if it is a bad id or was deleted between the two
     59   *  operations.
     60   *
     61   *  NOTE: This makes it easier to get 100% binary coverage since the
     62   *        bad Id case is handled by the switch.
     63   */
    5864  the_mutex = _POSIX_Mutex_Get( mutex, &location );
    5965  switch ( location ) {
     
    6470      );
    6571      the_mutex->Mutex.Attributes.priority_ceiling = the_priority;
     72      /*
     73       *  We are required to unlock the mutex before we return.
     74       */
    6675      _CORE_mutex_Surrender(
    6776        &the_mutex->Mutex,
     
    7079      );
    7180      _Thread_Enable_dispatch();
     81
    7282      return 0;
    7383
  • cpukit/score/src/coremutexsurrender.c

    r9a845e17 r06f5ec9  
    8585  the_mutex->nest_count--;
    8686
    87   if ( the_mutex->nest_count != 0 ) {
    88     switch ( the_mutex->Attributes.lock_nesting_behavior ) {
    89       case CORE_MUTEX_NESTING_ACQUIRES:
    90         return CORE_MUTEX_STATUS_SUCCESSFUL;
    91       case CORE_MUTEX_NESTING_IS_ERROR:
    92         /* should never occur */
    93         return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
    94       case CORE_MUTEX_NESTING_BLOCKS:
    95         /* Currently no API exercises this behavior. */
    96         break;
    97     }
     87  if ( the_mutex->nest_count != 0 ) {
     88    /*
     89     *  All error checking is on the locking side, so if the lock was
     90     *  allowed to acquired multiple times, then we should just deal with
     91     *  that.  The RTEMS_DEBUG is just a validation.
     92     */
     93    #if defined(RTEMS_DEBUG)
     94      switch ( the_mutex->Attributes.lock_nesting_behavior ) {
     95        case CORE_MUTEX_NESTING_ACQUIRES:
     96          return CORE_MUTEX_STATUS_SUCCESSFUL;
     97        case CORE_MUTEX_NESTING_IS_ERROR:
     98          /* should never occur */
     99          return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED;
     100        case CORE_MUTEX_NESTING_BLOCKS:
     101          /* Currently no API exercises this behavior. */
     102          break;
     103      }
     104    #else
     105      /* must be CORE_MUTEX_NESTING_ACQUIRES or we wouldn't be here */
     106      return CORE_MUTEX_STATUS_SUCCESSFUL;
     107    #endif
    98108  }
    99109
Note: See TracChangeset for help on using the changeset viewer.