void SwrDestroyContext(HANDLE hContext) { SWR_CONTEXT *pContext = (SWR_CONTEXT*)hContext; DestroyThreadPool(pContext, &pContext->threadPool); // free the fifos for (uint32_t i = 0; i < KNOB_MAX_DRAWS_IN_FLIGHT; ++i) { delete(pContext->dcRing[i].pTileMgr); delete(pContext->dcRing[i].pDispatch); } // Free scratch space. for (uint32_t i = 0; i < pContext->NumWorkerThreads; ++i) { _aligned_free(pContext->pScratch[i]); } _aligned_free(pContext->dcRing); _aligned_free(pContext->dsRing); delete(pContext->pHotTileMgr); pContext->~SWR_CONTEXT(); _aligned_free((SWR_CONTEXT*)hContext); }
DataHash::~DataHash() { #ifdef RAR_SMP DestroyThreadPool(ThPool); #endif cleandata(&blake2ctx, sizeof(blake2ctx)); cleandata(&CurCRC32, sizeof(CurCRC32)); }
RecVolumes3::~RecVolumes3() { for (size_t I=0;I<ASIZE(SrcFile);I++) delete SrcFile[I]; #ifdef RAR_SMP DestroyThreadPool(RSThreadPool); #endif }
RecVolumes5::~RecVolumes5() { delete[] RealBuf; delete[] RealReadBuffer; for (uint I=0;I<RecItems.Size();I++) delete RecItems[I].f; for (uint I=0;I<ASIZE(ThreadData);I++) delete ThreadData[I].RS; #ifdef RAR_SMP DestroyThreadPool(RecThreadPool); #endif }
CXtzThreadPool::~CXtzThreadPool( ) { DestroyThreadPool(); }
int Shutdown(lua_State* L) { #ifdef USE_BOOST_THREADS Msg("gm_navigation: Aborting threads...\n"); for(int i=0; i < JobQueue.Size(); i++) { JobQueue[i]->abort = true; /* if(JobQueue[i]->thread.joinable()) { JobQueue[i]->thread.join(); } */ Msg("gm_navigation: Aborting Thread %d\n", i); #ifdef FILEBUG FILEBUG_WRITE("Aborting...\n"); #endif while(!JobQueue[i]->finished && !JobQueue[i]->thread.timed_join(timeout)) { boost::this_thread::sleep(sleep_time); Msg("Waiting...\n"); } #ifdef FILEBUG FILEBUG_WRITE("Aborted\n"); #endif Msg("gm_navigation: Aborted\n"); } Msg("gm_navigation: Done\n"); #else if(threadPool != NULL) { for(int i=0; i < JobQueue.Size(); i++) { JobQueue[i]->abort = true; } threadPool->Stop(); DestroyThreadPool(threadPool); threadPool = NULL; } #endif if(objVector) { objVector->UnReference(); objVector = NULL; } #ifdef FILEBUG if(pDebugFile != NULL) { fputs("Closed Module\n", pDebugFile); fclose(pDebugFile); } #endif return 0; }