diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-08-23 21:31:27 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-08-23 21:31:27 +0000 |
commit | 64c2aa9ae07212c7ef15e5f5e993a7017a719235 (patch) | |
tree | e7361d39e5a459c0e89cfe056c2f93d12b86a7a9 /cpukit/posix/src/condtimedwait.c | |
parent | 85b9e7fd96f81951eba685ea83b090331238675e (diff) |
2010-08-23 Joel Sherrill <joel.sherrill@oarcorp.com>
CID 79/DEADCODE
CID 78/DEADCODE
CID 77/DEADCODE
CID 76/DEADCODE
* posix/src/condtimedwait.c, posix/src/mutextimedlock.c,
posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c,
posix/src/semtimedwait.c: Resolve various dead code issues identified
by Coverity scanner.
Diffstat (limited to 'cpukit/posix/src/condtimedwait.c')
-rw-r--r-- | cpukit/posix/src/condtimedwait.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/cpukit/posix/src/condtimedwait.c b/cpukit/posix/src/condtimedwait.c index aa48131ecd..4134a73f8a 100644 --- a/cpukit/posix/src/condtimedwait.c +++ b/cpukit/posix/src/condtimedwait.c @@ -39,8 +39,9 @@ int pthread_cond_timedwait( const struct timespec *abstime ) { - Watchdog_Interval ticks; - bool already_timedout; + Watchdog_Interval ticks; + bool already_timedout; + POSIX_Absolute_timeout_conversion_results_t status; /* * POSIX requires that blocking calls with timeouts that take @@ -51,18 +52,14 @@ int pthread_cond_timedwait( * then we do a polling operation and convert the UNSATISFIED * status into the appropriate error. */ - switch ( _POSIX_Absolute_timeout_to_ticks(abstime, &ticks) ) { - case POSIX_ABSOLUTE_TIMEOUT_INVALID: - return EINVAL; - case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST: - case POSIX_ABSOLUTE_TIMEOUT_IS_NOW: - already_timedout = true; - break; - case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE: - default: /* only to silence warnings */ - already_timedout = false; - break; - } + already_timedout = false; + status = _POSIX_Absolute_timeout_to_ticks(abstime, &ticks); + if ( status == POSIX_ABSOLUTE_TIMEOUT_INVALID ) + return EINVAL; + + if ( status == POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST || + status == POSIX_ABSOLUTE_TIMEOUT_IS_NOW ) + already_timedout = true; return _POSIX_Condition_variables_Wait_support( cond, |