diff options
author | Justin Clark-Casey (justincc) | 2012-05-11 01:37:03 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-05-11 01:37:03 +0100 |
commit | 93b615c51df3dec8276aead52141534a7ed32ff9 (patch) | |
tree | 23633237275ff7a80f921d61e7e4bf1d744508a0 /OpenSim | |
parent | Change bot.IsConnected to be ConnectionState with Disconnected, Connecting, C... (diff) | |
download | opensim-SC-93b615c51df3dec8276aead52141534a7ed32ff9.zip opensim-SC-93b615c51df3dec8276aead52141534a7ed32ff9.tar.gz opensim-SC-93b615c51df3dec8276aead52141534a7ed32ff9.tar.bz2 opensim-SC-93b615c51df3dec8276aead52141534a7ed32ff9.tar.xz |
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
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Tools/pCampBot/BotManager.cs | 21 |
1 files 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 | |||
251 | } | 251 | } |
252 | 252 | ||
253 | /// <summary> | 253 | /// <summary> |
254 | /// Shutting down all bots | 254 | /// Shut down all bots |
255 | /// </summary> | 255 | /// </summary> |
256 | /// <remarks> | ||
257 | /// We launch each shutdown on its own thread so that a slow shutting down bot doesn't hold up all the others. | ||
258 | /// </remarks> | ||
256 | public void doBotShutdown() | 259 | public void doBotShutdown() |
257 | { | 260 | { |
258 | lock (m_lBot) | 261 | lock (m_lBot) |
259 | foreach (Bot pb in m_lBot) | 262 | { |
260 | pb.shutdown(); | 263 | foreach (Bot bot in m_lBot) |
264 | { | ||
265 | Bot thisBot = bot; | ||
266 | Util.FireAndForget(o => thisBot.shutdown()); | ||
267 | } | ||
268 | } | ||
261 | } | 269 | } |
262 | 270 | ||
263 | /// <summary> | 271 | /// <summary> |
@@ -271,11 +279,8 @@ namespace pCampBot | |||
271 | 279 | ||
272 | private void HandleShutdown(string module, string[] cmd) | 280 | private void HandleShutdown(string module, string[] cmd) |
273 | { | 281 | { |
274 | Util.FireAndForget(o => | 282 | m_log.Info("[BOTMANAGER]: Shutting down bots"); |
275 | { | 283 | doBotShutdown(); |
276 | m_log.Warn("[BOTMANAGER]: Shutting down bots"); | ||
277 | doBotShutdown(); | ||
278 | }); | ||
279 | } | 284 | } |
280 | 285 | ||
281 | private void HandleShowRegions(string module, string[] cmd) | 286 | private void HandleShowRegions(string module, string[] cmd) |