mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2026-08-28 17:11:56 +08:00
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.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2009-10-10 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||
|
||||
* score/inline/rtems/score/object.inl: _Objects_Get_local_object() is
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -56,8 +56,9 @@ int mq_timedsend(
|
||||
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 @@ int mq_timedsend(
|
||||
* 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_Send_support(
|
||||
mqdes,
|
||||
|
||||
@@ -43,7 +43,7 @@ int pthread_mutex_timedlock(
|
||||
)
|
||||
{
|
||||
Watchdog_Interval ticks;
|
||||
bool do_wait;
|
||||
bool do_wait = true;
|
||||
POSIX_Absolute_timeout_conversion_results_t status;
|
||||
int lock_status;
|
||||
|
||||
@@ -55,19 +55,14 @@ int pthread_mutex_timedlock(
|
||||
* 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.
|
||||
*/
|
||||
status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
|
||||
switch ( status ) {
|
||||
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;
|
||||
}
|
||||
if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
|
||||
do_wait = false;
|
||||
|
||||
lock_status = _POSIX_Mutex_Lock_support( mutex, do_wait, ticks );
|
||||
/*
|
||||
|
||||
@@ -43,7 +43,7 @@ int pthread_rwlock_timedrdlock(
|
||||
POSIX_RWLock_Control *the_rwlock;
|
||||
Objects_Locations location;
|
||||
Watchdog_Interval ticks;
|
||||
bool do_wait;
|
||||
bool do_wait = true;
|
||||
POSIX_Absolute_timeout_conversion_results_t status;
|
||||
|
||||
if ( !rwlock )
|
||||
@@ -57,19 +57,14 @@ int pthread_rwlock_timedrdlock(
|
||||
* 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.
|
||||
*/
|
||||
status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
|
||||
switch (status) {
|
||||
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;
|
||||
}
|
||||
if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
|
||||
do_wait = false;
|
||||
|
||||
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
|
||||
switch ( location ) {
|
||||
|
||||
@@ -43,7 +43,7 @@ int pthread_rwlock_timedwrlock(
|
||||
POSIX_RWLock_Control *the_rwlock;
|
||||
Objects_Locations location;
|
||||
Watchdog_Interval ticks;
|
||||
bool do_wait;
|
||||
bool do_wait = true;
|
||||
POSIX_Absolute_timeout_conversion_results_t status;
|
||||
|
||||
if ( !rwlock )
|
||||
@@ -57,19 +57,14 @@ int pthread_rwlock_timedwrlock(
|
||||
* 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.
|
||||
*/
|
||||
status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
|
||||
switch (status) {
|
||||
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;
|
||||
}
|
||||
if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
|
||||
do_wait = false;
|
||||
|
||||
the_rwlock = _POSIX_RWLock_Get( rwlock, &location );
|
||||
switch ( location ) {
|
||||
|
||||
@@ -52,18 +52,14 @@ int sem_timedwait(
|
||||
* 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.
|
||||
*/
|
||||
status = _POSIX_Absolute_timeout_to_ticks( abstime, &ticks );
|
||||
switch ( status ) {
|
||||
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:
|
||||
do_wait = true;
|
||||
break;
|
||||
}
|
||||
if ( status != POSIX_ABSOLUTE_TIMEOUT_IS_IN_FUTURE )
|
||||
do_wait = false;
|
||||
|
||||
lock_status = _POSIX_Semaphore_Wait_support( sem, do_wait, ticks );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user