fix timing errors in thread wait functions on unix. patch by makovick fixes bug #1154212

This commit is contained in:
Ted Percival
2005-03-24 19:46:50 +00:00
parent 382db74f8f
commit e1ab8c5b77
3 changed files with 28 additions and 19 deletions
@@ -4,6 +4,7 @@
#include "RageUtil.h"
#include <sys/time.h>
#include <errno.h>
#include "arch/ArchHooks/ArchHooks_Unix.h"
#if defined(LINUX)
#include "archutils/Unix/LinuxThreadHelpers.h"
@@ -226,8 +227,8 @@ bool EventImpl_Pthreads::Wait( RageTimer *pTimeout )
}
timespec abstime;
abstime.tv_sec = pTimeout->m_secs;
abstime.tv_nsec = pTimeout->m_us * 1000;
abstime.tv_sec = pTimeout->m_secs + ArchHooks_Unix::iStartTime/1000000;
abstime.tv_nsec = (pTimeout->m_us + ArchHooks_Unix::iStartTime%1000000) * 1000;
int iRet = pthread_cond_timedwait( &m_Cond, &m_pParent->mutex, &abstime );
return iRet != ETIMEDOUT;
}