keep this around as a reminder; this doesn't matter for normal clocks, but it's not good for CLOCK_MONOTONIC
This commit is contained in:
@@ -229,6 +229,7 @@ bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 1
|
||||||
float fSecondsInFuture = -pTimeout->Ago();
|
float fSecondsInFuture = -pTimeout->Ago();
|
||||||
|
|
||||||
RageTimer timeofday;
|
RageTimer timeofday;
|
||||||
@@ -244,6 +245,13 @@ bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
|
|||||||
timespec abstime;
|
timespec abstime;
|
||||||
abstime.tv_sec = timeofday.m_secs;
|
abstime.tv_sec = timeofday.m_secs;
|
||||||
abstime.tv_nsec = timeofday.m_us * 1000;
|
abstime.tv_nsec = timeofday.m_us * 1000;
|
||||||
|
#else
|
||||||
|
/* XXX: This is how it should look for CLOCK_MONOTONIC: simply use the
|
||||||
|
* time directly. This requires that the condition be set to that clock,
|
||||||
|
* which requires pthread_condattr_setclock(). */
|
||||||
|
abstime.tv_sec = pTimeout->m_secs;
|
||||||
|
abstime.tv_nsec = pTimeout->m_us * 1000;
|
||||||
|
#endif
|
||||||
|
|
||||||
int iRet = pthread_cond_timedwait( &m_Cond, &m_pParent->mutex, &abstime );
|
int iRet = pthread_cond_timedwait( &m_Cond, &m_pParent->mutex, &abstime );
|
||||||
return iRet != ETIMEDOUT;
|
return iRet != ETIMEDOUT;
|
||||||
|
|||||||
Reference in New Issue
Block a user