diff options
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index cf2bf33..3cb999b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Threading; | ||
29 | using System.Collections; | 30 | using System.Collections; |
30 | using System.Collections.Generic; | 31 | using System.Collections.Generic; |
31 | using System.Diagnostics; | 32 | using System.Diagnostics; |
@@ -74,7 +75,7 @@ namespace OpenSim | |||
74 | 75 | ||
75 | private string m_timedScript = "disabled"; | 76 | private string m_timedScript = "disabled"; |
76 | private int m_timeInterval = 1200; | 77 | private int m_timeInterval = 1200; |
77 | private Timer m_scriptTimer; | 78 | private System.Timers.Timer m_scriptTimer; |
78 | 79 | ||
79 | public OpenSim(IConfigSource configSource) : base(configSource) | 80 | public OpenSim(IConfigSource configSource) : base(configSource) |
80 | { | 81 | { |
@@ -125,6 +126,21 @@ namespace OpenSim | |||
125 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); | 126 | m_log.Info("[OPENSIM MAIN]: Using async_call_method " + Util.FireAndForgetMethod); |
126 | } | 127 | } |
127 | 128 | ||
129 | private static Mono.Unix.UnixSignal[] signals; | ||
130 | |||
131 | |||
132 | private Thread signal_thread = new Thread (delegate () | ||
133 | { | ||
134 | while (true) | ||
135 | { | ||
136 | // Wait for a signal to be delivered | ||
137 | int index = Mono.Unix.UnixSignal.WaitAny (signals, -1); | ||
138 | |||
139 | //Mono.Unix.Native.Signum signal = signals [index].Signum; | ||
140 | MainConsole.Instance.RunCommand("shutdown"); | ||
141 | } | ||
142 | }); | ||
143 | |||
128 | /// <summary> | 144 | /// <summary> |
129 | /// Performs initialisation of the scene, such as loading configuration from disk. | 145 | /// Performs initialisation of the scene, such as loading configuration from disk. |
130 | /// </summary> | 146 | /// </summary> |
@@ -134,6 +150,24 @@ namespace OpenSim | |||
134 | m_log.Info("========================= STARTING OPENSIM ========================="); | 150 | m_log.Info("========================= STARTING OPENSIM ========================="); |
135 | m_log.Info("===================================================================="); | 151 | m_log.Info("===================================================================="); |
136 | 152 | ||
153 | if(!Util.IsWindows()) | ||
154 | { | ||
155 | try | ||
156 | { | ||
157 | // linux mac os specifics | ||
158 | signals = new Mono.Unix.UnixSignal[] | ||
159 | { | ||
160 | new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGTERM) | ||
161 | }; | ||
162 | signal_thread.Start(); | ||
163 | } | ||
164 | catch (Exception e) | ||
165 | { | ||
166 | m_log.Info("Could not set up UNIX signal handlers. SIGTERM will not"); | ||
167 | m_log.InfoFormat("shut down gracefully: {0}", e.Message); | ||
168 | m_log.Debug("Exception was: ", e); | ||
169 | } | ||
170 | } | ||
137 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); | 171 | //m_log.InfoFormat("[OPENSIM MAIN]: GC Is Server GC: {0}", GCSettings.IsServerGC.ToString()); |
138 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx | 172 | // http://msdn.microsoft.com/en-us/library/bb384202.aspx |
139 | //GCSettings.LatencyMode = GCLatencyMode.Batch; | 173 | //GCSettings.LatencyMode = GCLatencyMode.Batch; |
@@ -217,7 +251,7 @@ namespace OpenSim | |||
217 | // Start timer script (run a script every xx seconds) | 251 | // Start timer script (run a script every xx seconds) |
218 | if (m_timedScript != "disabled") | 252 | if (m_timedScript != "disabled") |
219 | { | 253 | { |
220 | m_scriptTimer = new Timer(); | 254 | m_scriptTimer = new System.Timers.Timer(); |
221 | m_scriptTimer.Enabled = true; | 255 | m_scriptTimer.Enabled = true; |
222 | m_scriptTimer.Interval = m_timeInterval*1000; | 256 | m_scriptTimer.Interval = m_timeInterval*1000; |
223 | m_scriptTimer.Elapsed += RunAutoTimerScript; | 257 | m_scriptTimer.Elapsed += RunAutoTimerScript; |