Fixed timed event wait on Linux.
Was causing an error message and the DeadlockDetect didn't work.
This commit is contained in:
parent
493100bdb0
commit
539ae20466
|
@ -144,24 +144,19 @@ cEvent::eWaitResult cEvent::Wait(int a_TimeoutMilliSec)
|
||||||
timeout.tv_sec = a_TimeoutMilliSec / 1000;
|
timeout.tv_sec = a_TimeoutMilliSec / 1000;
|
||||||
timeout.tv_nsec = (a_TimeoutMilliSec % 1000) * 1000000;
|
timeout.tv_nsec = (a_TimeoutMilliSec % 1000) * 1000000;
|
||||||
int res = sem_timedwait(m_Event, &timeout);
|
int res = sem_timedwait(m_Event, &timeout);
|
||||||
switch (res)
|
if (res == 0)
|
||||||
{
|
{
|
||||||
case 0:
|
// The semaphore was signalled
|
||||||
{
|
return wrSignalled;
|
||||||
// The semaphore was signalled
|
|
||||||
return wrSignalled;
|
|
||||||
}
|
|
||||||
case ETIMEDOUT:
|
|
||||||
{
|
|
||||||
// The timeout was hit
|
|
||||||
return wrTimeout;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
{
|
|
||||||
LOGWARNING("cEvent: timed-waiting for the event failed: %i, errno = %i. Continuing, but server may be unstable.", res, errno);
|
|
||||||
return wrError;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
int err = errno;
|
||||||
|
if (err == ETIMEDOUT)
|
||||||
|
{
|
||||||
|
// The timeout was hit
|
||||||
|
return wrTimeout;
|
||||||
|
}
|
||||||
|
LOGWARNING("cEvent: timed-waiting for the event failed: %i, errno = %i. Continuing, but server may be unstable.", res, err);
|
||||||
|
return wrError;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user