diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-07 17:29:47 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2009-07-07 17:29:47 +0000 |
commit | 06f5ec9ce0fc6e876f40a4f07975049751fee669 (patch) | |
tree | eed4c95664050c92cd77533429feb583ecab9e2f /cpukit/score/src | |
parent | 2009-07-07 Joel Sherrill <joel.sherrill@OARcorp.com> (diff) | |
download | rtems-06f5ec9ce0fc6e876f40a4f07975049751fee669.tar.bz2 |
2009-07-07 Joel Sherrill <joel.sherrill@OARcorp.com>
* 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.
Diffstat (limited to 'cpukit/score/src')
-rw-r--r-- | cpukit/score/src/coremutexsurrender.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/cpukit/score/src/coremutexsurrender.c b/cpukit/score/src/coremutexsurrender.c index 16268934af..28d4b5d876 100644 --- a/cpukit/score/src/coremutexsurrender.c +++ b/cpukit/score/src/coremutexsurrender.c @@ -84,17 +84,27 @@ CORE_mutex_Status _CORE_mutex_Surrender( the_mutex->nest_count--; - if ( the_mutex->nest_count != 0 ) { - switch ( the_mutex->Attributes.lock_nesting_behavior ) { - case CORE_MUTEX_NESTING_ACQUIRES: - return CORE_MUTEX_STATUS_SUCCESSFUL; - case CORE_MUTEX_NESTING_IS_ERROR: - /* should never occur */ - return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; - case CORE_MUTEX_NESTING_BLOCKS: - /* Currently no API exercises this behavior. */ - break; - } + if ( the_mutex->nest_count != 0 ) { + /* + * All error checking is on the locking side, so if the lock was + * allowed to acquired multiple times, then we should just deal with + * that. The RTEMS_DEBUG is just a validation. + */ + #if defined(RTEMS_DEBUG) + switch ( the_mutex->Attributes.lock_nesting_behavior ) { + case CORE_MUTEX_NESTING_ACQUIRES: + return CORE_MUTEX_STATUS_SUCCESSFUL; + case CORE_MUTEX_NESTING_IS_ERROR: + /* should never occur */ + return CORE_MUTEX_STATUS_NESTING_NOT_ALLOWED; + case CORE_MUTEX_NESTING_BLOCKS: + /* Currently no API exercises this behavior. */ + break; + } + #else + /* must be CORE_MUTEX_NESTING_ACQUIRES or we wouldn't be here */ + return CORE_MUTEX_STATUS_SUCCESSFUL; + #endif } /* |