diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index cf2bf33231..203fe5ec8b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -26,6 +26,7 @@ */ using System; +using System.Threading; using System.Collections; using System.Collections.Generic; using System.Diagnostics; @@ -74,7 +75,7 @@ namespace OpenSim private string m_timedScript = "disabled"; private int m_timeInterval = 1200; - private Timer m_scriptTimer; + private System.Timers.Timer m_scriptTimer; public OpenSim(IConfigSource configSource) : base(configSource) { @@ -125,6 +126,25 @@ namespace OpenSim m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); } + private static Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] + { +// new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT), + new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM) + }; + + private Thread signal_thread = new Thread (delegate () + { + System.Console.WriteLine("------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); + while (true) + { + // Wait for a signal to be delivered + int index = Mono.Unix.UnixSignal.WaitAny (signals, -1); + + //Mono.Unix.Native.Signum signal = signals [index].Signum; + MainConsole.Instance.RunCommand("shutdown"); + } + }); + /// /// Performs initialisation of the scene, such as loading configuration from disk. /// @@ -134,6 +154,7 @@ namespace OpenSim m_log.Info("========================= STARTING OPENSIM ========================="); m_log.Info("===================================================================="); + signal_thread.Start(); //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); // http://msdn.microsoft.com/en-us/library/bb384202.aspx //GCSettings.LatencyMode = GCLatencyMode.Batch; @@ -217,7 +238,7 @@ namespace OpenSim // Start timer script (run a script every xx seconds) if (m_timedScript != "disabled") { - m_scriptTimer = new Timer(); + m_scriptTimer = new System.Timers.Timer(); m_scriptTimer.Enabled = true; m_scriptTimer.Interval = m_timeInterval*1000; m_scriptTimer.Elapsed += RunAutoTimerScript; diff --git a/bin/Mono.Posix.dll b/bin/Mono.Posix.dll new file mode 100755 index 0000000000..97ec8bf3f2 Binary files /dev/null and b/bin/Mono.Posix.dll differ diff --git a/prebuild.xml b/prebuild.xml index 2bb053ec51..cb39e18e16 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1790,6 +1790,7 @@ +