Remove unnecessary shutting down check in Scene.Heartbeat(). Add some method doc. Rename HeartbeatThread, shuttingdown to conform to code standards.
parent
c0672cb7db
commit
349454ca27
|
@ -230,8 +230,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private int m_LastLogin;
|
private int m_LastLogin;
|
||||||
|
|
||||||
private Thread HeartbeatThread;
|
/// <summary>
|
||||||
private volatile bool shuttingdown;
|
/// Thread that runs the scene loop.
|
||||||
|
/// </summary>
|
||||||
|
private Thread m_heartbeatThread;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True if these scene is in the process of shutting down or is shutdown.
|
||||||
|
/// </summary>
|
||||||
|
public bool ShuttingDown
|
||||||
|
{
|
||||||
|
get { return m_shuttingDown; }
|
||||||
|
}
|
||||||
|
private volatile bool m_shuttingDown;
|
||||||
|
|
||||||
// private int m_lastUpdate;
|
// private int m_lastUpdate;
|
||||||
// private bool m_firstHeartbeat = true;
|
// private bool m_firstHeartbeat = true;
|
||||||
|
@ -811,11 +822,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
#region Startup / Close Methods
|
#region Startup / Close Methods
|
||||||
|
|
||||||
public bool ShuttingDown
|
|
||||||
{
|
|
||||||
get { return shuttingdown; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <value>
|
/// <value>
|
||||||
/// The scene graph for this scene
|
/// The scene graph for this scene
|
||||||
/// </value>
|
/// </value>
|
||||||
|
@ -1134,8 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
|
ForEachScenePresence(delegate(ScenePresence avatar) { avatar.ControllingClient.Close(); });
|
||||||
|
|
||||||
// Stop updating the scene objects and agents.
|
// Stop updating the scene objects and agents.
|
||||||
//m_heartbeatTimer.Close();
|
m_shuttingDown = true;
|
||||||
shuttingdown = true;
|
|
||||||
|
|
||||||
m_log.Debug("[SCENE]: Persisting changed objects");
|
m_log.Debug("[SCENE]: Persisting changed objects");
|
||||||
EventManager.TriggerSceneShuttingDown(this);
|
EventManager.TriggerSceneShuttingDown(this);
|
||||||
|
@ -1168,14 +1173,14 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
//m_heartbeatTimer.Enabled = true;
|
//m_heartbeatTimer.Enabled = true;
|
||||||
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
|
//m_heartbeatTimer.Interval = (int)(m_timespan * 1000);
|
||||||
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
|
//m_heartbeatTimer.Elapsed += new ElapsedEventHandler(Heartbeat);
|
||||||
if (HeartbeatThread != null)
|
if (m_heartbeatThread != null)
|
||||||
{
|
{
|
||||||
HeartbeatThread.Abort();
|
m_heartbeatThread.Abort();
|
||||||
HeartbeatThread = null;
|
m_heartbeatThread = null;
|
||||||
}
|
}
|
||||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
HeartbeatThread
|
m_heartbeatThread
|
||||||
= Watchdog.StartThread(
|
= Watchdog.StartThread(
|
||||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
||||||
}
|
}
|
||||||
|
@ -1222,9 +1227,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// alarms for scenes with many objects.
|
// alarms for scenes with many objects.
|
||||||
Update(1);
|
Update(1);
|
||||||
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
|
||||||
|
Update(-1);
|
||||||
while (!shuttingdown)
|
|
||||||
Update(-1);
|
|
||||||
|
|
||||||
// m_lastUpdate = Util.EnvironmentTickCount();
|
// m_lastUpdate = Util.EnvironmentTickCount();
|
||||||
// m_firstHeartbeat = false;
|
// m_firstHeartbeat = false;
|
||||||
|
@ -1252,7 +1255,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
List<Vector3> coarseLocations;
|
List<Vector3> coarseLocations;
|
||||||
List<UUID> avatarUUIDs;
|
List<UUID> avatarUUIDs;
|
||||||
|
|
||||||
while (!shuttingdown && (endFrame == null || Frame < endFrame))
|
while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
|
||||||
{
|
{
|
||||||
maintc = Util.EnvironmentTickCount();
|
maintc = Util.EnvironmentTickCount();
|
||||||
++Frame;
|
++Frame;
|
||||||
|
|
Loading…
Reference in New Issue