diff options
author | Justin Clark-Casey (justincc) | 2012-03-23 01:46:11 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-23 01:46:11 +0000 |
commit | 349454ca2740d5eb5d465f0d45ebd49975556dd5 (patch) | |
tree | c260fafdba68bd00d0e402a94dbc7d47b80961bd /OpenSim/Region/Framework | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC-349454ca2740d5eb5d465f0d45ebd49975556dd5.zip opensim-SC-349454ca2740d5eb5d465f0d45ebd49975556dd5.tar.gz opensim-SC-349454ca2740d5eb5d465f0d45ebd49975556dd5.tar.bz2 opensim-SC-349454ca2740d5eb5d465f0d45ebd49975556dd5.tar.xz |
Remove unnecessary shutting down check in Scene.Heartbeat(). Add some method doc. Rename HeartbeatThread, shuttingdown to conform to code standards.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d354ef0..09b91c0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -230,8 +230,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
230 | /// </summary> | 230 | /// </summary> |
231 | private int m_LastLogin; | 231 | private int m_LastLogin; |
232 | 232 | ||
233 | private Thread HeartbeatThread; | 233 | /// <summary> |
234 | private volatile bool shuttingdown; | 234 | /// Thread that runs the scene loop. |
235 | /// </summary> | ||
236 | private Thread m_heartbeatThread; | ||
237 | |||
238 | /// <summary> | ||
239 | /// True if these scene is in the process of shutting down or is shutdown. | ||
240 | /// </summary> | ||
241 | public bool ShuttingDown | ||
242 | { | ||
243 | get { return m_shuttingDown; } | ||
244 | } | ||
245 | private volatile bool m_shuttingDown; | ||
235 | 246 | ||
236 | // private int m_lastUpdate; | 247 | // private int m_lastUpdate; |
237 | // private bool m_firstHeartbeat = true; | 248 | // private bool m_firstHeartbeat = true; |
@@ -811,11 +822,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
811 | 822 | ||
812 | #region Startup / Close Methods | 823 | #region Startup / Close Methods |
813 | 824 | ||
814 | public bool ShuttingDown | ||
815 | { | ||
816 | get { return shuttingdown; } | ||
817 | } | ||
818 | |||
819 | /// <value> | 825 | /// <value> |
820 | /// The scene graph for this scene | 826 | /// The scene graph for this scene |
821 | /// </value> | 827 | /// </value> |
@@ -1134,8 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1134 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); | 1140 | ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); }); |
1135 | 1141 | ||
1136 | // Stop updating the scene objects and agents. | 1142 | // Stop updating the scene objects and agents. |
1137 | //m_heartbeatTimer.Close(); | 1143 | m_shuttingDown = true; |
1138 | shuttingdown = true; | ||
1139 | 1144 | ||
1140 | m_log.Debug("[SCENE]: Persisting changed objects"); | 1145 | m_log.Debug("[SCENE]: Persisting changed objects"); |
1141 | EventManager.TriggerSceneShuttingDown(this); | 1146 | EventManager.TriggerSceneShuttingDown(this); |
@@ -1168,14 +1173,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1168 | //m_heartbeatTimer.Enabled = true; | 1173 | //m_heartbeatTimer.Enabled = true; |
1169 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); | 1174 | //m_heartbeatTimer.Interval = (int)(m_timespan * 1000); |
1170 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); | 1175 | //m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat); |
1171 | if (HeartbeatThread != null) | 1176 | if (m_heartbeatThread != null) |
1172 | { | 1177 | { |
1173 | HeartbeatThread.Abort(); | 1178 | m_heartbeatThread.Abort(); |
1174 | HeartbeatThread = null; | 1179 | m_heartbeatThread = null; |
1175 | } | 1180 | } |
1176 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1181 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1177 | 1182 | ||
1178 | HeartbeatThread | 1183 | m_heartbeatThread |
1179 | = Watchdog.StartThread( | 1184 | = Watchdog.StartThread( |
1180 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); | 1185 | Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); |
1181 | } | 1186 | } |
@@ -1222,9 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1222 | // alarms for scenes with many objects. | 1227 | // alarms for scenes with many objects. |
1223 | Update(1); | 1228 | Update(1); |
1224 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1229 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1225 | 1230 | Update(-1); | |
1226 | while (!shuttingdown) | ||
1227 | Update(-1); | ||
1228 | 1231 | ||
1229 | // m_lastUpdate = Util.EnvironmentTickCount(); | 1232 | // m_lastUpdate = Util.EnvironmentTickCount(); |
1230 | // m_firstHeartbeat = false; | 1233 | // m_firstHeartbeat = false; |
@@ -1252,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1252 | List<Vector3> coarseLocations; | 1255 | List<Vector3> coarseLocations; |
1253 | List<UUID> avatarUUIDs; | 1256 | List<UUID> avatarUUIDs; |
1254 | 1257 | ||
1255 | while (!shuttingdown && (endFrame == null || Frame < endFrame)) | 1258 | while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) |
1256 | { | 1259 | { |
1257 | maintc = Util.EnvironmentTickCount(); | 1260 | maintc = Util.EnvironmentTickCount(); |
1258 | ++Frame; | 1261 | ++Frame; |