diff options
author | John Hurliman | 2009-10-22 12:33:23 -0700 |
---|---|---|
committer | John Hurliman | 2009-10-22 12:33:23 -0700 |
commit | b2ed348aa2746fbf034b713d006e40366c479d5a (patch) | |
tree | 26c114e88f54e64e1fdf17dcc7de1e54165db2bc /OpenSim/Region/CoreModules/World | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.zip opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.gz opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.bz2 opensim-SC_OLD-b2ed348aa2746fbf034b713d006e40366c479d5a.tar.xz |
Implemented a Watchdog class. Do not manually create Thread objects anymore, use Watchdog.StartThread(). While your thread is running call Watchdog.UpdateThread(). When it is shutting down call Watchdog.RemoveThread(). Most of the threads in OpenSim have been updated
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 13 |
2 files changed, 9 insertions, 12 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index fe9c8d9..c9fce91 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs | |||
@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
128 | if (m_repliesRequired == 0) | 128 | if (m_repliesRequired == 0) |
129 | { | 129 | { |
130 | m_requestState = RequestState.Completed; | 130 | m_requestState = RequestState.Completed; |
131 | PerformAssetsRequestCallback(); | 131 | PerformAssetsRequestCallback(null); |
132 | return; | 132 | return; |
133 | } | 133 | } |
134 | 134 | ||
@@ -246,9 +246,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
246 | 246 | ||
247 | // We want to stop using the asset cache thread asap | 247 | // We want to stop using the asset cache thread asap |
248 | // as we now need to do the work of producing the rest of the archive | 248 | // as we now need to do the work of producing the rest of the archive |
249 | Thread newThread = new Thread(PerformAssetsRequestCallback); | 249 | Util.FireAndForget(PerformAssetsRequestCallback); |
250 | newThread.Name = "OpenSimulator archiving thread post assets receipt"; | ||
251 | newThread.Start(); | ||
252 | } | 250 | } |
253 | else | 251 | else |
254 | { | 252 | { |
@@ -265,7 +263,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
265 | /// <summary> | 263 | /// <summary> |
266 | /// Perform the callback on the original requester of the assets | 264 | /// Perform the callback on the original requester of the assets |
267 | /// </summary> | 265 | /// </summary> |
268 | protected void PerformAssetsRequestCallback() | 266 | protected void PerformAssetsRequestCallback(object o) |
269 | { | 267 | { |
270 | try | 268 | try |
271 | { | 269 | { |
diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index 4e40084..a4bcbad 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | |||
@@ -74,7 +74,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
74 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); | 74 | private Dictionary<ulong, int> m_blacklistedregions = new Dictionary<ulong, int>(); |
75 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); | 75 | private Dictionary<ulong, string> m_cachedRegionMapItemsAddress = new Dictionary<ulong, string>(); |
76 | private List<UUID> m_rootAgents = new List<UUID>(); | 76 | private List<UUID> m_rootAgents = new List<UUID>(); |
77 | private Thread mapItemReqThread; | ||
78 | private volatile bool threadrunning = false; | 77 | private volatile bool threadrunning = false; |
79 | 78 | ||
80 | //private int CacheRegionsDistance = 256; | 79 | //private int CacheRegionsDistance = 256; |
@@ -338,13 +337,10 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
338 | { | 337 | { |
339 | if (threadrunning) return; | 338 | if (threadrunning) return; |
340 | threadrunning = true; | 339 | threadrunning = true; |
340 | |||
341 | m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); | 341 | m_log.Debug("[WORLD MAP]: Starting remote MapItem request thread"); |
342 | mapItemReqThread = new Thread(new ThreadStart(process)); | 342 | |
343 | mapItemReqThread.IsBackground = true; | 343 | Watchdog.StartThread(process, "MapItemRequestThread", ThreadPriority.BelowNormal, true); |
344 | mapItemReqThread.Name = "MapItemRequestThread"; | ||
345 | mapItemReqThread.Priority = ThreadPriority.BelowNormal; | ||
346 | mapItemReqThread.SetApartmentState(ApartmentState.MTA); | ||
347 | mapItemReqThread.Start(); | ||
348 | } | 344 | } |
349 | 345 | ||
350 | /// <summary> | 346 | /// <summary> |
@@ -461,6 +457,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
461 | OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); | 457 | OSDMap response = RequestMapItemsAsync("", st.agentID, st.flags, st.EstateID, st.godlike, st.itemtype, st.regionhandle); |
462 | RequestMapItemsCompleted(response); | 458 | RequestMapItemsCompleted(response); |
463 | } | 459 | } |
460 | |||
461 | Watchdog.UpdateThread(); | ||
464 | } | 462 | } |
465 | } | 463 | } |
466 | catch (Exception e) | 464 | catch (Exception e) |
@@ -469,6 +467,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap | |||
469 | } | 467 | } |
470 | 468 | ||
471 | threadrunning = false; | 469 | threadrunning = false; |
470 | Watchdog.RemoveThread(); | ||
472 | } | 471 | } |
473 | 472 | ||
474 | /// <summary> | 473 | /// <summary> |