Cleaner version of wait with timeout fix.
This commit is contained in:
@@ -131,25 +131,19 @@ epicsEventWaitWithTimeout(epicsEventId id, double timeOut)
|
||||
{
|
||||
rtems_id sid = (rtems_id)id;
|
||||
rtems_status_code sc;
|
||||
uint32_t wait;
|
||||
rtems_interval delay;
|
||||
extern double rtemsTicksPerSecond_double;
|
||||
|
||||
if (timeOut <= 0.0)
|
||||
return epicsEventTryWait(id);
|
||||
SEMSTAT(1)
|
||||
if (timeOut <= 0.0) {
|
||||
wait = RTEMS_NO_WAIT;
|
||||
delay = 0;
|
||||
}
|
||||
else {
|
||||
wait = RTEMS_WAIT;
|
||||
delay = timeOut * rtemsTicksPerSecond_double;
|
||||
if (delay == 0)
|
||||
delay++;
|
||||
}
|
||||
sc = rtems_semaphore_obtain (sid, wait, delay);
|
||||
delay = timeOut * rtemsTicksPerSecond_double;
|
||||
if (delay == 0)
|
||||
delay++;
|
||||
sc = rtems_semaphore_obtain (sid, RTEMS_WAIT, delay);
|
||||
if (sc == RTEMS_SUCCESSFUL)
|
||||
return epicsEventWaitOK;
|
||||
else if ((sc == RTEMS_TIMEOUT) || (sc == RTEMS_UNSATISFIED))
|
||||
else if (sc == RTEMS_TIMEOUT)
|
||||
return epicsEventWaitTimeout;
|
||||
else
|
||||
return epicsEventWaitError;
|
||||
|
||||
Reference in New Issue
Block a user