@@ -386,7 +386,7 @@ namespace CorUnix
386386 if (dwTimeout != INFINITE)
387387 {
388388 // Calculate absolute timeout
389- palErr = GetAbsoluteTimeout (dwTimeout, &tsAbsTmo, /* fPreferMonotonicClock */ TRUE );
389+ palErr = GetAbsoluteTimeout (dwTimeout, &tsAbsTmo);
390390 if (NO_ERROR != palErr)
391391 {
392392 ERROR (" Failed to convert timeout to absolute timeout\n " );
@@ -1051,7 +1051,7 @@ namespace CorUnix
10511051 ptnwdWorkerThreadNativeData =
10521052 &pSynchManager->m_pthrWorker ->synchronizationInfo .m_tnwdNativeData ;
10531053
1054- palErr = GetAbsoluteTimeout (WorkerThreadTerminationTimeout, &tsAbsTmo, /* fPreferMonotonicClock */ TRUE );
1054+ palErr = GetAbsoluteTimeout (WorkerThreadTerminationTimeout, &tsAbsTmo);
10551055 if (NO_ERROR != palErr)
10561056 {
10571057 ERROR (" Failed to convert timeout to absolute timeout\n " );
@@ -2671,7 +2671,7 @@ namespace CorUnix
26712671 VolatileStore<DWORD>(pdwWaitState, TWS_ACTIVE);
26722672 m_tsThreadState = TS_STARTING;
26732673
2674- #if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
2674+ #if HAVE_PTHREAD_CONDATTR_SETCLOCK
26752675 attrsPtr = &attrs;
26762676 iRet = pthread_condattr_init (&attrs);
26772677 if (0 != iRet)
@@ -2699,7 +2699,7 @@ namespace CorUnix
26992699 pthread_condattr_destroy (&attrs);
27002700 goto IPrC_exit;
27012701 }
2702- #endif // HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
2702+ #endif // HAVE_PTHREAD_CONDATTR_SETCLOCK
27032703
27042704 iEagains = 0 ;
27052705 Mutex_retry:
@@ -2990,41 +2990,32 @@ namespace CorUnix
29902990
29912991 Converts a relative timeout to an absolute one.
29922992 --*/
2993- PAL_ERROR CPalSynchronizationManager::GetAbsoluteTimeout (DWORD dwTimeout, struct timespec * ptsAbsTmo, BOOL fPreferMonotonicClock )
2993+ PAL_ERROR CPalSynchronizationManager::GetAbsoluteTimeout (DWORD dwTimeout, struct timespec * ptsAbsTmo)
29942994 {
29952995 PAL_ERROR palErr = NO_ERROR;
29962996 int iRet;
29972997
2998- #if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
2999- if (fPreferMonotonicClock )
2998+ #if HAVE_PTHREAD_CONDATTR_SETCLOCK
2999+ iRet = clock_gettime (CLOCK_MONOTONIC, ptsAbsTmo);
3000+ #elif HAVE_WORKING_CLOCK_GETTIME
3001+ // Not every platform implements a (working) clock_gettime
3002+ iRet = clock_gettime (CLOCK_REALTIME, ptsAbsTmo);
3003+ #elif HAVE_WORKING_GETTIMEOFDAY
3004+ // Not every platform implements a (working) gettimeofday
3005+ struct timeval tv;
3006+ iRet = gettimeofday (&tv, NULL );
3007+ if (0 == iRet)
30003008 {
3001- iRet = clock_gettime (CLOCK_MONOTONIC, ptsAbsTmo);
3009+ ptsAbsTmo->tv_sec = tv.tv_sec ;
3010+ ptsAbsTmo->tv_nsec = tv.tv_usec * tccMicroSecondsToNanoSeconds;
30023011 }
3003- else
3004- {
3005- #endif
3006- #if HAVE_WORKING_CLOCK_GETTIME
3007- // Not every platform implements a (working) clock_gettime
3008- iRet = clock_gettime (CLOCK_REALTIME, ptsAbsTmo);
3009- #elif HAVE_WORKING_GETTIMEOFDAY
3010- // Not every platform implements a (working) gettimeofday
3011- struct timeval tv;
3012- iRet = gettimeofday (&tv, NULL );
3013- if (0 == iRet)
3014- {
3015- ptsAbsTmo->tv_sec = tv.tv_sec ;
3016- ptsAbsTmo->tv_nsec = tv.tv_usec * tccMicroSecondsToNanoSeconds;
3017- }
30183012#else
30193013#ifdef DBI_COMPONENT_MONO
30203014 return ERROR_INTERNAL_ERROR;
30213015#else
30223016 #error "Don't know how to get hi-res current time on this platform"
30233017#endif
30243018#endif // HAVE_WORKING_CLOCK_GETTIME, HAVE_WORKING_GETTIMEOFDAY
3025- #if HAVE_CLOCK_MONOTONIC && HAVE_PTHREAD_CONDATTR_SETCLOCK
3026- }
3027- #endif
30283019 if (0 == iRet)
30293020 {
30303021 ptsAbsTmo->tv_sec += dwTimeout / tccSecondsToMilliSeconds;
0 commit comments