File tree Expand file tree Collapse file tree 2 files changed +3
-22
lines changed
Server/mods/deathmatch/logic Expand file tree Collapse file tree 2 files changed +3
-22
lines changed Original file line number Diff line number Diff line change @@ -365,9 +365,6 @@ CGame::~CGame()
365365 // Stop async task scheduler
366366 SAFE_DELETE (m_pAsyncTaskScheduler);
367367
368- // Shutdown thread pool before destroying resources to prevent tasks being enqueued during shutdown
369- CThreadPool::getDefaultThreadPool ().shutdown ();
370-
371368 // Destroy our stuff
372369 SAFE_DELETE (m_pResourceManager);
373370
@@ -426,6 +423,7 @@ CGame::~CGame()
426423 SAFE_DELETE (m_pASE);
427424 SAFE_RELEASE (m_pHqComms);
428425 CSimControl::Shutdown ();
426+ CThreadPool::getDefaultThreadPool ().shutdown ();
429427
430428 // Clear our global pointer
431429 g_pGame = NULL ;
Original file line number Diff line number Diff line change @@ -102,27 +102,10 @@ namespace SharedUtil
102102
103103 m_exit = true ;
104104
105- // Discard all remaining tasks
105+ // Clear all remaining tasks (they will be destroyed automatically)
106106 while (!m_tasks.empty ())
107107 {
108- // Run each task with skip flag to clean up without executing
109- auto task = std::move (m_tasks.front ());
110- m_tasks.pop (); // Important: Remove from queue to avoid infinite loop
111-
112- // Execute cleanup outside the critical section to reduce lock contention
113- lock.unlock ();
114- try
115- {
116- task (true ); // Cleanup the shared_ptr
117- }
118- catch (...)
119- {
120- // Exceptions during cleanup indicate a serious bug (e.g., corrupted lambda)
121- // We cannot propagate this exception as we're mid-shutdown with the lock released.
122- // In debug builds, this should be logged/asserted.
123- dassert (false && " Exception during thread pool task cleanup" );
124- }
125- lock.lock ();
108+ m_tasks.pop ();
126109 }
127110 }
128111
You can’t perform that action at this time.
0 commit comments