summaryrefslogtreecommitdiffstats
path: root/cpukit/posix/src/mqueuetimedreceive.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 15:21:41 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2009-10-10 15:21:41 +0000
commit6805ac371836bdb1114869cdf4e229cde248ff97 (patch)
treeb766cc34cde1f527a43f6e11e22c4fb48eea2c40 /cpukit/posix/src/mqueuetimedreceive.c
parent2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-6805ac371836bdb1114869cdf4e229cde248ff97.tar.bz2
2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
* posix/src/mqueuetimedreceive.c, posix/src/mqueuetimedsend.c, posix/src/mutextimedlock.c, posix/src/prwlocktimedrdlock.c, posix/src/prwlocktimedwrlock.c, posix/src/semtimedwait.c: Switch from switch to if's because only one value needed to be tested. This shrinks the code and makes it easier to do coverage analysis on.
Diffstat (limited to 'cpukit/posix/src/mqueuetimedreceive.c')
-rw-r--r--cpukit/posix/src/mqueuetimedreceive.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/cpukit/posix/src/mqueuetimedreceive.c b/cpukit/posix/src/mqueuetimedreceive.c
index 0ed59084a8..62a5abe339 100644
--- a/cpukit/posix/src/mqueuetimedreceive.c
+++ b/cpukit/posix/src/mqueuetimedreceive.c
@@ -56,8 +56,9 @@ ssize_t mq_timedreceive(
const struct timespec *abstime
)
{
- Watchdog_Interval ticks;
- bool do_wait;
+ Watchdog_Interval ticks;
+ bool do_wait = true;
+ POSIX_Absolute_timeout_conversion_results_t status;
/*
* POSIX requires that blocking calls with timeouts that take
@@ -67,18 +68,14 @@ ssize_t mq_timedreceive(
* is valid or not. If it isn't correct and in the future,
* then we do a polling operation and convert the UNSATISFIED
* status into the appropriate error.
+ *
+ * If the status is POSIX_ABSOLUTE_TIMEOUT_INVALID,
+ * POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST, or POSIX_ABSOLUTE_TIMEOUT_IS_NOW,
+ * then we should not wait.
*/
- switch ( _POSIX_Absolute_timeout_to_ticks( abstime, &ticks ) ) {
- case POSIX_ABSOLUTE_TIMEOUT_INVALID:
- case POSIX_ABSOLUTE_TIMEOUT_IS_IN_PAST:
- case POSIX_ABSOLUTE_TIMEOUT_IS_NOW:
- do_wait = false;
- break;
- case POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE:
- default: /* only to silence warnings */
- do_wait = true;
- break;
- }
+ status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
+ if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
+ do_wait = false;
return _POSIX_Message_queue_Receive_support(
mqdes,