Allow OpenSim to respond to Unix signals. This may need work to be
properly ignoed on Windows. Windows devs, please test and check for platform flags if this causes issues in Windowsmelanie
parent
ba61b64c42
commit
4d1536f1ec
|
@ -26,6 +26,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -74,7 +75,7 @@ namespace OpenSim
|
||||||
|
|
||||||
private string m_timedScript = "disabled";
|
private string m_timedScript = "disabled";
|
||||||
private int m_timeInterval = 1200;
|
private int m_timeInterval = 1200;
|
||||||
private Timer m_scriptTimer;
|
private System.Timers.Timer m_scriptTimer;
|
||||||
|
|
||||||
public OpenSim(IConfigSource configSource) : base(configSource)
|
public OpenSim(IConfigSource configSource) : base(configSource)
|
||||||
{
|
{
|
||||||
|
@ -125,6 +126,25 @@ namespace OpenSim
|
||||||
m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod);
|
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");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Performs initialisation of the scene, such as loading configuration from disk.
|
/// Performs initialisation of the scene, such as loading configuration from disk.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -134,6 +154,7 @@ namespace OpenSim
|
||||||
m_log.Info("========================= STARTING OPENSIM =========================");
|
m_log.Info("========================= STARTING OPENSIM =========================");
|
||||||
m_log.Info("====================================================================");
|
m_log.Info("====================================================================");
|
||||||
|
|
||||||
|
signal_thread.Start();
|
||||||
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
|
//m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString());
|
||||||
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
|
// http://msdn.microsoft.com/en-us/library/bb384202.aspx
|
||||||
//GCSettings.LatencyMode = GCLatencyMode.Batch;
|
//GCSettings.LatencyMode = GCLatencyMode.Batch;
|
||||||
|
@ -217,7 +238,7 @@ namespace OpenSim
|
||||||
// Start timer script (run a script every xx seconds)
|
// Start timer script (run a script every xx seconds)
|
||||||
if (m_timedScript != "disabled")
|
if (m_timedScript != "disabled")
|
||||||
{
|
{
|
||||||
m_scriptTimer = new Timer();
|
m_scriptTimer = new System.Timers.Timer();
|
||||||
m_scriptTimer.Enabled = true;
|
m_scriptTimer.Enabled = true;
|
||||||
m_scriptTimer.Interval = m_timeInterval*1000;
|
m_scriptTimer.Interval = m_timeInterval*1000;
|
||||||
m_scriptTimer.Elapsed += RunAutoTimerScript;
|
m_scriptTimer.Elapsed += RunAutoTimerScript;
|
||||||
|
|
Binary file not shown.
|
@ -1790,6 +1790,7 @@
|
||||||
<Reference name="System.Core"/>
|
<Reference name="System.Core"/>
|
||||||
<Reference name="System.Xml"/>
|
<Reference name="System.Xml"/>
|
||||||
<Reference name="Mono.Addins" path="../../../bin/"/>
|
<Reference name="Mono.Addins" path="../../../bin/"/>
|
||||||
|
<Reference name="Mono.Posix" path="../../../bin/"/>
|
||||||
<Reference name="NDesk.Options" path="../../../bin/"/>
|
<Reference name="NDesk.Options" path="../../../bin/"/>
|
||||||
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
|
||||||
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
|
||||||
|
|
Loading…
Reference in New Issue