aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-25 23:56:32 +0000
committerJustin Clark-Casey (justincc)2014-11-25 23:56:32 +0000
commit86367d7219b3bd52f63045b2b17bcbde328844ed (patch)
tree789227d95cb152a437481e741b55d86dfeba9f74 /OpenSim/Region/Framework/Scenes
parentFix ghosts copy of SimulatorFeatureModule to enable logging. (diff)
downloadopensim-SC-86367d7219b3bd52f63045b2b17bcbde328844ed.zip
opensim-SC-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.gz
opensim-SC-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.bz2
opensim-SC-86367d7219b3bd52f63045b2b17bcbde328844ed.tar.xz
refactor: Move methods to start a monitored thread, start work in its own thread and run work in the jobengine from Watchdog to a WorkManager class.
This is to achieve a clean separation of concerns - the watchdog is an inappropriate place for work management. Also adds a WorkManager.RunInThreadPool() class which feeds through to Util.FireAndForget. Also switches around the name and obj arguments to the new RunInThread() and RunJob() methods so that the callback obj comes after the callback as seen in the SDK and elsewhere
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs22
2 files changed, 17 insertions, 17 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 171f066..f7c12d6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1428,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1428 } 1428 }
1429 1429
1430 m_heartbeatThread 1430 m_heartbeatThread
1431 = Watchdog.StartThread( 1431 = WorkManager.StartThread(
1432 Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false); 1432 Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false);
1433 1433
1434 StartScripts(); 1434 StartScripts();
@@ -1469,7 +1469,7 @@ namespace OpenSim.Region.Framework.Scenes
1469 // alarms for scenes with many objects. 1469 // alarms for scenes with many objects.
1470 Update(1); 1470 Update(1);
1471 1471
1472 Watchdog.StartThread( 1472 WorkManager.StartThread(
1473 Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); 1473 Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true);
1474 1474
1475 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; 1475 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
@@ -1568,10 +1568,10 @@ namespace OpenSim.Region.Framework.Scenes
1568 tmpMS = Util.EnvironmentTickCount(); 1568 tmpMS = Util.EnvironmentTickCount();
1569 m_cleaningTemps = true; 1569 m_cleaningTemps = true;
1570 1570
1571 Watchdog.RunInThread( 1571 WorkManager.RunInThread(
1572 delegate { CleanTempObjects(); m_cleaningTemps = false; }, 1572 delegate { CleanTempObjects(); m_cleaningTemps = false; },
1573 string.Format("CleanTempObjects ({0})", Name), 1573 null,
1574 null); 1574 string.Format("CleanTempObjects ({0})", Name));
1575 1575
1576 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); 1576 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1577 } 1577 }
@@ -1843,7 +1843,7 @@ namespace OpenSim.Region.Framework.Scenes
1843 if (!m_backingup) 1843 if (!m_backingup)
1844 { 1844 {
1845 m_backingup = true; 1845 m_backingup = true;
1846 Watchdog.RunInThread(o => Backup(false), string.Format("BackupWaitCallback ({0})", Name), null); 1846 WorkManager.RunInThread(o => Backup(false), null, string.Format("BackupWaitCallback ({0})", Name));
1847 } 1847 }
1848 } 1848 }
1849 1849
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 757ec43..5a35aff 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1228,11 +1228,11 @@ namespace OpenSim.Region.Framework.Scenes
1228 // viewers without (e.g. v1 viewers) will not, so we still need to make this call. 1228 // viewers without (e.g. v1 viewers) will not, so we still need to make this call.
1229 if (Scene.AttachmentsModule != null) 1229 if (Scene.AttachmentsModule != null)
1230 { 1230 {
1231 Watchdog.RunJob( 1231 WorkManager.RunJob(
1232 "RezAttachments", 1232 "RezAttachments",
1233 o => Scene.AttachmentsModule.RezAttachments(this), 1233 o => Scene.AttachmentsModule.RezAttachments(this),
1234 string.Format("Rez attachments for {0} in {1}", Name, Scene.Name), 1234 null,
1235 null); 1235 string.Format("Rez attachments for {0} in {1}", Name, Scene.Name));
1236 } 1236 }
1237 } 1237 }
1238 else 1238 else
@@ -1254,11 +1254,11 @@ namespace OpenSim.Region.Framework.Scenes
1254 1254
1255 if (attachments.Count > 0) 1255 if (attachments.Count > 0)
1256 { 1256 {
1257 Watchdog.RunJob( 1257 WorkManager.RunJob(
1258 "StartAttachmentScripts", 1258 "StartAttachmentScripts",
1259 o => RestartAttachmentScripts(attachments), 1259 o => RestartAttachmentScripts(attachments),
1260 string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name),
1261 null, 1260 null,
1261 string.Format("Start attachment scripts for {0} in {1}", Name, Scene.Name),
1262 true); 1262 true);
1263 } 1263 }
1264 } 1264 }
@@ -1815,11 +1815,11 @@ namespace OpenSim.Region.Framework.Scenes
1815 // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region 1815 // XXX: If we force an update after activity has completed, then multiple attachments do appear correctly on a destination region
1816 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work. 1816 // If we do it a little bit earlier (e.g. when converting the child to a root agent) then this does not work.
1817 // This may be due to viewer code or it may be something we're not doing properly simulator side. 1817 // This may be due to viewer code or it may be something we're not doing properly simulator side.
1818 Watchdog.RunJob( 1818 WorkManager.RunJob(
1819 "ScheduleAttachmentsForFullUpdate", 1819 "ScheduleAttachmentsForFullUpdate",
1820 o => ScheduleAttachmentsForFullUpdate(), 1820 o => ScheduleAttachmentsForFullUpdate(),
1821 string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name),
1822 null, 1821 null,
1822 string.Format("Schedule attachments for full update for {0} in {1}", Name, Scene.Name),
1823 true); 1823 true);
1824 1824
1825 // m_log.DebugFormat( 1825 // m_log.DebugFormat(
@@ -3375,7 +3375,7 @@ namespace OpenSim.Region.Framework.Scenes
3375 SentInitialDataToClient = true; 3375 SentInitialDataToClient = true;
3376 3376
3377 // Send all scene object to the new client 3377 // Send all scene object to the new client
3378 Watchdog.RunJob("SendInitialDataToClient", delegate 3378 WorkManager.RunJob("SendInitialDataToClient", delegate
3379 { 3379 {
3380// m_log.DebugFormat( 3380// m_log.DebugFormat(
3381// "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}", 3381// "[SCENE PRESENCE]: Sending initial data to {0} agent {1} in {2}, tp flags {3}",
@@ -3393,7 +3393,7 @@ namespace OpenSim.Region.Framework.Scenes
3393 if (e != null && e is SceneObjectGroup) 3393 if (e != null && e is SceneObjectGroup)
3394 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient); 3394 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
3395 } 3395 }
3396 }, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name),null, false, true); 3396 }, null, string.Format("SendInitialDataToClient ({0} in {1})", Name, Scene.Name), false, true);
3397 } 3397 }
3398 3398
3399 /// <summary> 3399 /// <summary>
@@ -4057,11 +4057,11 @@ namespace OpenSim.Region.Framework.Scenes
4057 // We don't need to worry about a race condition as the job to later start the scripts is also 4057 // We don't need to worry about a race condition as the job to later start the scripts is also
4058 // JobEngine scheduled and so will always occur after this task. 4058 // JobEngine scheduled and so will always occur after this task.
4059 // XXX: This will not be true if JobEngine ever gets more than one thread. 4059 // XXX: This will not be true if JobEngine ever gets more than one thread.
4060 Watchdog.RunJob( 4060 WorkManager.RunJob(
4061 "CopyAttachments", 4061 "CopyAttachments",
4062 o => Scene.AttachmentsModule.CopyAttachments(cAgent, this), 4062 o => Scene.AttachmentsModule.CopyAttachments(cAgent, this),
4063 string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name),
4064 null, 4063 null,
4064 string.Format("Copy attachments for {0} entering {1}", Name, Scene.Name),
4065 true); 4065 true);
4066 } 4066 }
4067 4067