mirror of
https://github.com/celisej567/source-engine.git
synced 2025-12-31 21:48:22 +03:00
Merge branch 'master' into windows
This commit is contained in:
@@ -68,7 +68,7 @@ private:
|
||||
CMemoryStack m_Strings;
|
||||
struct hash_item_t
|
||||
{
|
||||
int stringIndex;
|
||||
intp stringIndex;
|
||||
hash_item_t *next;
|
||||
};
|
||||
CUtlMemoryPool m_HashItemMemPool;
|
||||
@@ -79,7 +79,7 @@ private:
|
||||
|
||||
struct MemoryLeakTracker_t
|
||||
{
|
||||
int nameIndex;
|
||||
intp nameIndex;
|
||||
void *pMem;
|
||||
};
|
||||
static bool MemoryLeakTrackerLessFunc( const MemoryLeakTracker_t &lhs, const MemoryLeakTracker_t &rhs )
|
||||
@@ -108,8 +108,8 @@ IKeyValuesSystem *KeyValuesSystem()
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Constructor
|
||||
//-----------------------------------------------------------------------------
|
||||
CKeyValuesSystem::CKeyValuesSystem()
|
||||
: m_HashItemMemPool(sizeof(hash_item_t), 64, UTLMEMORYPOOL_GROW_FAST, "CKeyValuesSystem::m_HashItemMemPool")
|
||||
CKeyValuesSystem::CKeyValuesSystem()
|
||||
: m_HashItemMemPool(sizeof(hash_item_t), 64, CUtlMemoryPool::GROW_FAST, "CKeyValuesSystem::m_HashItemMemPool")
|
||||
, m_KeyValuesTrackingList(0, 0, MemoryLeakTrackerLessFunc)
|
||||
, m_KeyValueCache( UtlStringLessFunc )
|
||||
{
|
||||
|
||||
@@ -585,7 +585,7 @@ private:
|
||||
CUtlVector<HCoroutine> m_VecCoroutineStack;
|
||||
};
|
||||
|
||||
CThreadLocalPtr< CCoroutineMgr > g_ThreadLocalCoroutineMgr;
|
||||
CTHREADLOCALPTR(CCoroutineMgr) g_ThreadLocalCoroutineMgr;
|
||||
|
||||
CUtlVector< CCoroutineMgr * > g_VecPCoroutineMgr;
|
||||
CThreadMutex g_ThreadMutexCoroutineMgr;
|
||||
@@ -610,7 +610,7 @@ void Coroutine_ReleaseThreadMemory()
|
||||
{
|
||||
AUTO_LOCK( g_ThreadMutexCoroutineMgr );
|
||||
|
||||
if ( g_ThreadLocalCoroutineMgr != NULL )
|
||||
if ( g_ThreadLocalCoroutineMgr != static_cast<const void*>( nullptr ) )
|
||||
{
|
||||
int iCoroutineMgr = g_VecPCoroutineMgr.Find( g_ThreadLocalCoroutineMgr );
|
||||
delete g_VecPCoroutineMgr[iCoroutineMgr];
|
||||
|
||||
@@ -227,7 +227,7 @@ public:
|
||||
// and execute or execute pFunctor right after completing current job and
|
||||
// before looking for another job.
|
||||
//-----------------------------------------------------
|
||||
void ExecuteHighPriorityFunctor( CFunctor *pFunctor );
|
||||
// void ExecuteHighPriorityFunctor( CFunctor *pFunctor );
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Add an function object to the queue (master thread)
|
||||
@@ -247,8 +247,6 @@ public:
|
||||
|
||||
virtual void Reserved1() {}
|
||||
|
||||
void WaitForIdle( bool bAll = true );
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
@@ -418,7 +416,7 @@ private:
|
||||
CFunctor *pFunctor = NULL;
|
||||
tmZone( TELEMETRY_LEVEL0, TMZF_NONE, "%s PeekCall():%d", __FUNCTION__, GetCallParam() );
|
||||
|
||||
switch ( GetCallParam( &pFunctor ) )
|
||||
switch ( GetCallParam() )
|
||||
{
|
||||
case TPM_EXIT:
|
||||
Reply( true );
|
||||
@@ -427,10 +425,10 @@ private:
|
||||
|
||||
case TPM_SUSPEND:
|
||||
Reply( true );
|
||||
SuspendCooperative();
|
||||
Suspend();
|
||||
break;
|
||||
|
||||
case TPM_RUNFUNCTOR:
|
||||
/* case TPM_RUNFUNCTOR:
|
||||
if( pFunctor )
|
||||
{
|
||||
( *pFunctor )();
|
||||
@@ -441,7 +439,7 @@ private:
|
||||
Assert( pFunctor );
|
||||
Reply( false );
|
||||
}
|
||||
break;
|
||||
break;*/
|
||||
|
||||
default:
|
||||
AssertMsg( 0, "Unknown call to thread" );
|
||||
@@ -535,7 +533,7 @@ int CThreadPool::NumIdleThreads()
|
||||
return m_nIdleThreads;
|
||||
}
|
||||
|
||||
void CThreadPool::ExecuteHighPriorityFunctor( CFunctor *pFunctor )
|
||||
/*void CThreadPool::ExecuteHighPriorityFunctor( CFunctor *pFunctor )
|
||||
{
|
||||
int i;
|
||||
for ( i = 0; i < m_Threads.Count(); i++ )
|
||||
@@ -547,7 +545,7 @@ void CThreadPool::ExecuteHighPriorityFunctor( CFunctor *pFunctor )
|
||||
{
|
||||
m_Threads[i]->WaitForReply();
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
//---------------------------------------------------------
|
||||
// Pause/resume processing jobs
|
||||
@@ -575,7 +573,10 @@ int CThreadPool::SuspendExecution()
|
||||
// here with the thread not actually suspended
|
||||
for ( i = 0; i < m_Threads.Count(); i++ )
|
||||
{
|
||||
m_Threads[i]->BWaitForThreadSuspendCooperative();
|
||||
while ( !m_Threads[i]->IsSuspended() )
|
||||
{
|
||||
ThreadSleep();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +594,7 @@ int CThreadPool::ResumeExecution()
|
||||
{
|
||||
for ( int i = 0; i < m_Threads.Count(); i++ )
|
||||
{
|
||||
m_Threads[i]->ResumeCooperative();
|
||||
m_Threads[i]->Resume();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -601,13 +602,6 @@ int CThreadPool::ResumeExecution()
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
void CThreadPool::WaitForIdle( bool bAll )
|
||||
{
|
||||
ThreadWaitForEvents( m_IdleEvents.Count(), m_IdleEvents.Base(), bAll, 60000 );
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
||||
int CThreadPool::YieldWait( CThreadEvent **pEvents, int nEvents, bool bWaitAll, unsigned timeout )
|
||||
{
|
||||
tmZone( TELEMETRY_LEVEL0, TMZF_IDLE, "%s(%d) SPINNING %t", __FUNCTION__, timeout, tmSendCallStack( TELEMETRY_LEVEL0, 0 ) );
|
||||
@@ -618,7 +612,7 @@ int CThreadPool::YieldWait( CThreadEvent **pEvents, int nEvents, bool bWaitAll,
|
||||
CJob *pJob;
|
||||
// Always wait for zero milliseconds initially, to let us process jobs on this thread.
|
||||
timeout = 0;
|
||||
while ( ( result = ThreadWaitForEvents( nEvents, pEvents, bWaitAll, timeout ) ) == WAIT_TIMEOUT )
|
||||
while ( ( result = CThreadEvent::WaitForMultiple( nEvents, pEvents, bWaitAll, timeout ) ) == TW_TIMEOUT )
|
||||
{
|
||||
if ( !m_bExecOnThreadPoolThreadsOnly && m_SharedQueue.Pop( &pJob ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user