From ba745a524d4f13552f8ed3827a7315b3000cbe53 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 2 Jul 2014 23:48:44 +0100 Subject: Actually call Close() for shared region modules when the simulator is being shutdown. Adds regression test for this case. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 8 +++++++- OpenSim/Framework/Util.cs | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 54e6061..828a852 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -57,6 +57,11 @@ namespace OpenSim.Framework.Servers private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); /// + /// Used by tests to suppress Environment.Exit(0) so that post-run operations are possible. + /// + public bool SuppressExit { get; set; } + + /// /// This will control a periodic log printout of the current 'show stats' (if they are active) for this /// server. /// @@ -109,7 +114,8 @@ namespace OpenSim.Framework.Servers base.ShutdownSpecific(); - Environment.Exit(0); + if (!SuppressExit) + Environment.Exit(0); } /// diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 740e55a..729281c 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -1964,10 +1964,15 @@ namespace OpenSim.Framework { if (maxThreads < 2) throw new ArgumentOutOfRangeException("maxThreads", "maxThreads must be greater than 2"); + if (minThreads > maxThreads || minThreads < 2) throw new ArgumentOutOfRangeException("minThreads", "minThreads must be greater than 2 and less than or equal to maxThreads"); + if (m_ThreadPool != null) - throw new InvalidOperationException("SmartThreadPool is already initialized"); + { + m_log.Warn("SmartThreadPool is already initialized. Ignoring request."); + return; + } STPStartInfo startInfo = new STPStartInfo(); startInfo.ThreadPoolName = "Util"; -- cgit v1.1