add a bit more pre exit cleanup

0.9.0-post-fixes
UbitUmarov 2017-05-24 22:17:04 +01:00
parent 2008e65695
commit dca3a45803
4 changed files with 23 additions and 4 deletions

View File

@ -108,16 +108,16 @@ namespace OpenSim.Framework.Servers
protected override void ShutdownSpecific()
{
Watchdog.Enabled = false;
base.ShutdownSpecific();
MainServer.Stop();
Thread.Sleep(5000);
Util.StopThreadPool();
WorkManager.Stop();
Thread.Sleep(1000);
RemovePIDFile();
m_log.Info("[SHUTDOWN]: Shutdown processing on main thread complete. Exiting...");

View File

@ -2852,6 +2852,16 @@ namespace OpenSim.Framework
return stpi;
}
public static void StopThreadPool()
{
if (m_ThreadPool == null)
return;
SmartThreadPool pool = m_ThreadPool;
m_ThreadPool = null;
try { pool.Shutdown(); } catch {}
}
#endregion FireAndForget Threading Pattern
/// <summary>

View File

@ -249,6 +249,9 @@ namespace OpenSim.Server.Base
}
}
MemoryWatchdog.Enabled = false;
Watchdog.Enabled = false;
RemovePIDFile();
return 0;

View File

@ -31,6 +31,7 @@ using System.Reflection;
using System;
using System.Net;
using System.Collections.Generic;
using OpenSim.Framework;
using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer;
using OpenSim.Server.Base;
@ -161,6 +162,11 @@ namespace OpenSim.Server
int res = m_Server.Run();
if(m_Server != null)
m_Server.Shutdown();
Util.StopThreadPool();
Environment.Exit(res);
return 0;