From 529a3f2400bd4b94a5f9b5c032e3a9684cb72db6 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 11 May 2012 01:37:03 +0100 Subject: [PATCH] Do each bot shutdown on its own threads to prevent one slow shutdown holding up all the rest. This does increase the aggressiveness of shutdown Also prevents the bot list being locked for a long period, which was preventing commands such as "show bots" from working during shutdown --- OpenSim/Tools/pCampBot/BotManager.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/OpenSim/Tools/pCampBot/BotManager.cs b/OpenSim/Tools/pCampBot/BotManager.cs index 7392e5337c..ab3fb0b9b0 100644 --- a/OpenSim/Tools/pCampBot/BotManager.cs +++ b/OpenSim/Tools/pCampBot/BotManager.cs @@ -251,13 +251,21 @@ namespace pCampBot } /// - /// Shutting down all bots + /// Shut down all bots /// + /// + /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others. + /// public void doBotShutdown() { lock (m_lBot) - foreach (Bot pb in m_lBot) - pb.shutdown(); + { + foreach (Bot bot in m_lBot) + { + Bot thisBot = bot; + Util.FireAndForget(o => thisBot.shutdown()); + } + } } /// @@ -271,11 +279,8 @@ namespace pCampBot private void HandleShutdown(string module, string[] cmd) { - Util.FireAndForget(o => - { - m_log.Warn("[BOTMANAGER]: Shutting down bots"); - doBotShutdown(); - }); + m_log.Info("[BOTMANAGER]: Shutting down bots"); + doBotShutdown(); } private void HandleShowRegions(string module, string[] cmd)