From d02b0720813a62a4f1fe875e6e784843f5c2da46 Mon Sep 17 00:00:00 2001 From: Dan Engelbrecht Date: Wed, 15 Nov 2023 11:30:56 +0100 Subject: fix race contdition when signaling shutdown of process and waiting for completion (#539) --- src/zenserver/main.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/zenserver/main.cpp') diff --git a/src/zenserver/main.cpp b/src/zenserver/main.cpp index 69cc2bbf5..44330d4c8 100644 --- a/src/zenserver/main.cpp +++ b/src/zenserver/main.cpp @@ -198,13 +198,15 @@ ZenEntryPoint::Run() ShutdownThread.reset(new std::thread{[&] { SetCurrentThreadName("shutdown_monitor"); - ZEN_INFO("shutdown monitor thread waiting for shutdown signal '{}'", ShutdownEventName); + ZEN_INFO("shutdown monitor thread waiting for shutdown signal '{}' for process {}", + ShutdownEventName, + zen::GetCurrentProcessId()); if (ShutdownEvent->Wait()) { if (!IsApplicationExitRequested()) { - ZEN_INFO("shutdown signal received"); + ZEN_INFO("shutdown signal for pid {} received", zen::GetCurrentProcessId()); Server.RequestExit(0); } } @@ -244,7 +246,7 @@ ZenEntryPoint::Run() } catch (std::exception& e) { - ZEN_CRITICAL("Caught exception in main: {}", e.what()); + ZEN_CRITICAL("Caught exception in main for process {}: {}", zen::GetCurrentProcessId(), e.what()); if (!IsApplicationExitRequested()) { RequestApplicationExit(1); -- cgit v1.2.3