void CGlobalEntityList::Clear( void ) { m_bClearingEntities = true; // Add all remaining entities in the game to the delete list and call appropriate UpdateOnRemove CBaseHandle hCur = FirstHandle(); while ( hCur != InvalidHandle() ) { IServerNetworkable *ent = GetServerNetworkable( hCur ); if ( ent ) { MDLCACHE_CRITICAL_SECTION(); // Force UpdateOnRemove to be called UTIL_Remove( ent ); } hCur = NextHandle( hCur ); } CleanupDeleteList(); // free the memory g_DeleteList.Purge(); CBaseEntity::m_nDebugPlayer = -1; CBaseEntity::m_bInDebugSelect = false; m_iHighestEnt = 0; m_iNumEnts = 0; m_bClearingEntities = false; }
//----------------------------------------------------------------------------- // Purpose: Clears all entity lists and releases entities //----------------------------------------------------------------------------- void CClientEntityList::Release( void ) { // Free all the entities. ClientEntityHandle_t iter = FirstHandle(); ClientEntityHandle_t next; while( iter != InvalidHandle() ) { next = NextHandle( iter ); // Try to call release on anything we can. IClientNetworkable *pNet = GetClientNetworkableFromHandle( iter ); if ( pNet ) { pNet->Release(); } else { // Try to call release on anything we can. IClientThinkable *pThinkable = GetClientThinkableFromHandle( iter ); if ( pThinkable ) { pThinkable->Release(); } } RemoveEntity( iter ); iter = next; } m_iNumServerEnts = 0; m_iMaxServerEnts = 0; m_iMaxUsedServerIndex = -1; }
virtual uint32 GetAsynchronous(const TCHAR* CacheKey, IDerivedDataRollup* Rollup = NULL) override { if (Rollup) { FScopeLock ScopeLock(&SynchronizationObject); UE_LOG(LogDerivedDataCache, Verbose, TEXT("GetAsynchronous (Rollup) %s"), CacheKey); uint32 CurrentHandle = NextHandle(); ((FDerivedDataRollup*)Rollup)->Add(CacheKey, CurrentHandle); return CurrentHandle; } return Super::GetAsynchronous(CacheKey, NULL); }
virtual uint32 GetAsynchronous(const TCHAR* CacheKey, IDerivedDataRollup* Rollup = NULL) override { check(!Rollup); // this needs to be handled by someone else, if rollups are disabled, then it should be NULL FScopeLock ScopeLock(&SynchronizationObject); UE_LOG(LogDerivedDataCache, Verbose, TEXT("GetAsynchronous %s"), CacheKey); uint32 Handle = NextHandle(); FAsyncTask<FBuildAsyncWorker>* AsyncTask = new FAsyncTask<FBuildAsyncWorker>((FDerivedDataPluginInterface*)NULL, CacheKey, false); check(!PendingTasks.Contains(Handle)); PendingTasks.Add(Handle, AsyncTask); AddToAsyncCompletionCounter(1); AsyncTask->StartBackgroundTask(); return Handle; }
virtual uint32 GetAsynchronous(FDerivedDataPluginInterface* DataDeriver) { FScopeLock ScopeLock(&SynchronizationObject); uint32 Handle = NextHandle(); FString CacheKey = FDerivedDataCache::BuildCacheKey(DataDeriver); UE_LOG(LogDerivedDataCache, Verbose, TEXT("GetAsynchronous %s"), *CacheKey); bool bSync = !DataDeriver->IsBuildThreadsafe(); FAsyncTask<FBuildAsyncWorker>* AsyncTask = new FAsyncTask<FBuildAsyncWorker>(DataDeriver, *CacheKey, bSync); check(!PendingTasks.Contains(Handle)); PendingTasks.Add(Handle,AsyncTask); AddToAsyncCompletionCounter(1); if (!bSync) { AsyncTask->StartBackgroundTask(); } else { AsyncTask->StartSynchronousTask(); } // Must return a valid handle check(Handle != 0); return Handle; }
void FileProfDumpData ( HANDLE hFile ) { DWORD cChar, cWChar; register PFP_Handle phThisFile; HANDLE hToMem; void VerboseDumpHandleData(), AccumulateAllHandleData(), InitHandle(); void FreeMemoryOfHandle(); PFP_Handle NextHandle(); if ( (phActive == (PFP_Handle) NULL) && (phInactive == (PFP_Handle) NULL) && (! (ValidDataForDuplicatedHandles) ) ) return; // Initialize structure for statistics of all used files hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_Handle) ); phAllFiles = (PFP_Handle) GlobalLock ( hToMem ); hToMem = GlobalAlloc ( MEM_ATTR, (DWORD) sizeof (FileProf_FileH) ); phAllFiles->pfHandleData = (PFP_FileH) GlobalLock ( hToMem ); ulNumOfAllCreateOps = ulNumOfAllOpenOps = ulNumOfAllCloseOps = (ULONG) 0; ulNumOfFiles = (ULONG) 0; InitHandle ( phAllFiles ); // initialize dummy large integer liDummy.LowPart = (ULONG) 0; liDummy.HighPart = (LONG) 0; // print data table header cChar = wsprintf ( OutBuf, L" \t\t\t FILE I/O PROFILER OUTPUT\r\n\r\n\r\n\0" ); WriteFileAnsi(hFile, OutBuf, cChar, &cWChar, (LPOVERLAPPED) NULL); cChar = wsprintf ( OutBuf, L" \t\t (Note: All times are in microseconds)\r\n\r\n\0"); WriteFileAnsi(hFile, OutBuf, cChar, &cWChar, (LPOVERLAPPED) NULL); if ( phActive == (PFP_Handle) NULL ) if ( phInactive != (PFP_Handle) NULL ) phThisFile = phInactive; else phThisFile = (PFP_Handle) NULL; else phThisFile = phActive; // Dump data for normal files while ( phThisFile != (PFP_Handle) NULL ) { VerboseDumpHandleData ( hFile, phThisFile ); AccumulateAllHandleData ( phThisFile ); phThisFile = NextHandle ( phThisFile ); } // Dump data for duplicated handles if ( ValidDataForDuplicatedHandles ) { VerboseDumpHandleData ( hFile, phDuplicated ); AccumulateAllHandleData ( phDuplicated ); } // Dump accumulated statistics for all files VerboseDumpHandleData ( hFile, phAllFiles ); FreeMemoryOfHandle ( phAllFiles ); phAllFiles = (PFP_Handle) NULL; }