From 966e38ab75174a74ca3dce66d36ada091ab6ecb9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 13 Oct 2022 12:53:54 +0200 Subject: Core/Misc: Fixed worldserver shutdown with --update-databases-only (cherry picked from commit edc922d5320788a08b02d22b1dbe29b7becb9b93) --- src/server/worldserver/Main.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/server/worldserver/Main.cpp') diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index 68978183f51..9f601f8ceb1 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -253,6 +253,8 @@ extern int main(int argc, char** argv) for (int i = 0; i < numThreads; ++i) threadPool->PostWork([ioContext]() { ioContext->run(); }); + std::shared_ptr ioContextStopHandle(nullptr, [ioContext](void*) { ioContext->stop(); }); + // Set process priority according to configuration settings SetProcessPriority("server.worldserver", sConfigMgr->GetIntDefault(CONFIG_PROCESSOR_AFFINITY, 0), sConfigMgr->GetBoolDefault(CONFIG_HIGH_PRIORITY, false)); @@ -387,7 +389,7 @@ extern int main(int argc, char** argv) WorldUpdateLoop(); // Shutdown starts here - ioContext->stop(); + ioContextStopHandle.reset(); threadPool.reset(); -- cgit v1.2.3