Skip to content

Commit 4086307

Browse files
committed
fix hyper-threading
1 parent 0854390 commit 4086307

File tree

16 files changed

+1510
-1479
lines changed

16 files changed

+1510
-1479
lines changed

datacache/datacache.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ int CDataCacheSection::BeginFrameLocking()
479479
{
480480
while ( ( pFrameLock = m_FreeFrameLocks.Pop() ) == NULL )
481481
{
482-
ThreadPause();
483-
ThreadSleep( 1 );
482+
ThreadSleepEx( 1 );
484483
}
485484
pFrameLock->m_iLock = 1;
486485
pFrameLock->m_pFirst = NULL;

engine/audio/private/snd_dma.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6576,7 +6576,7 @@ void S_Update_Thread()
65766576
// try to maintain a steadier rate by compensating for fluctuating mix times
65776577
// leave 1 ms for tighter timings in loop
65786578
const int nSleepMS = (int) ((THREADED_MIX_TIME - dt) * 1000);
6579-
if ( nSleepMS > 0 )
6579+
if ( nSleepMS >= 0 )
65806580
{
65816581
ThreadSleep( nSleepMS );
65826582
}

engine/host.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ ConVar host_speeds( "host_speeds","0", 0, "Show general system running times." )
591591
ConVar host_flush_threshold( "host_flush_threshold", "20", 0, "Memory threshold below which the host should flush caches between server instances" );
592592

593593
void HostTimerSpinMsChangedCallback( IConVar *var, const char *pOldString, float flOldValue );
594-
ConVar host_timer_spin_ms( "host_timer_spin_ms", "0", FCVAR_NONE, "Use CPU busy-loop for improved timer precision (dedicated only)", HostTimerSpinMsChangedCallback );
594+
ConVar host_timer_spin_ms( "host_timer_spin_ms", "2", FCVAR_NONE, "Use CPU busy-loop for improved timer precision (dedicated only)", HostTimerSpinMsChangedCallback );
595595

596596
void HostTimerSpinMsChangedCallback( IConVar *var, const char *pOldString, float flOldValue )
597597
{
@@ -3962,7 +3962,7 @@ bool DLL_LOCAL Host_IsValidSignature( const char *pFilename, bool bAllowUnknown
39623962
while ( !Steam3Client().SteamUtils()->IsAPICallCompleted(hAPICall, &bAPICallFailed) )
39633963
{
39643964
SteamAPI_RunCallbacks();
3965-
ThreadSleep( 1 );
3965+
ThreadSleepEx( 1 );
39663966
}
39673967

39683968
if( bAPICallFailed )

engine/sys_engine.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,12 @@ void CEngine::Frame( void )
360360
int nSleepMS = (int)((m_flMinFrameTime - m_flFrameTime) * 1000 - fBusyWaitMS);
361361
if ( nSleepMS > 3 )
362362
{
363-
ThreadSleep(nSleepMS);
363+
ThreadSleepEx(nSleepMS);
364364
}
365365

366366
while (Plat_FloatTime() < fWaitEnd)
367367
{
368-
ThreadSleep();
368+
ThreadSleepEx();
369369
}
370370

371371
// Go back to the top of the loop and see if it is time yet.

game/client/youtubeapi.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class CYouTubeJob : public CJob
207207
// Wait for it to finish.
208208
while ( m_bHTTPRequestPending && !m_bCancelled )
209209
{
210-
ThreadSleep( 100 );
210+
ThreadSleepEx( 100 );
211211
}
212212

213213
GetISteamHTTP()->ReleaseHTTPRequest( hSteamAPICall );

game/server/tf/workshop/maps_workshop.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ void CTFMapsWorkshop::PrepareLevelResources( /* in/out */ char *pszMapName, size
653653
TFWorkshopMsg( "Waiting for steam connection\n" );
654654
while ( !steamgameserverapicontext->SteamGameServer()->BLoggedOn() )
655655
{
656-
ThreadSleep( 10 );
656+
ThreadSleepEx( 10 );
657657
}
658658
}
659659
}
@@ -663,7 +663,7 @@ void CTFMapsWorkshop::PrepareLevelResources( /* in/out */ char *pszMapName, size
663663
while ( AsyncPrepareLevelResources( pszMapName, nMapNameSize, pszMapFile, nMapFileSize ) == \
664664
IServerGameDLL::ePrepareLevelResources_InProgress )
665665
{
666-
ThreadSleep( 10 );
666+
ThreadSleepEx( 10 );
667667
if ( engine->IsDedicatedServer() )
668668
{
669669
SteamGameServer_RunCallbacks();

0 commit comments

Comments
 (0)