From 93b615c51df3dec8276aead52141534a7ed32ff9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 11 May 2012 01:37:03 +0100
Subject: 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 d4bbc2a..d06c55b 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)
--
cgit v1.1