From b2ed348aa2746fbf034b713d006e40366c479d5a Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Thu, 22 Oct 2009 12:33:23 -0700 Subject: 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 --- .../OptionalModules/ContentManagementSystem/CMController.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem') diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs index 16fe9e9..8d6c41d 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMController.cs @@ -86,7 +86,6 @@ namespace OpenSim.Region.OptionalModules.ContentManagement /// Hashtable m_sceneList = Hashtable.Synchronized(new Hashtable()); State m_state = State.NONE; - Thread m_thread = null; CMView m_view = null; #endregion Fields @@ -148,10 +147,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement lock (this) { m_estateModule = scene.RequestModuleInterface(); - m_thread = new Thread(MainLoop); - m_thread.Name = "Content Management"; - m_thread.IsBackground = true; - m_thread.Start(); + Watchdog.StartThread(MainLoop, "Content Management", ThreadPriority.Normal, true); m_state = State.NONE; } } @@ -200,6 +196,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement m_log.Debug("[CONTENT MANAGEMENT] MAIN LOOP -- uuuuuuuuuh, what?"); break; } + + Watchdog.UpdateThread(); } } catch (Exception e) @@ -209,6 +207,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement "[CONTENT MANAGEMENT]: Content management thread terminating with exception. PLEASE REBOOT YOUR SIM - CONTENT MANAGEMENT WILL NOT BE AVAILABLE UNTIL YOU DO. Exception is {0}", e); } + + Watchdog.RemoveThread(); } /// -- cgit v1.1 From 4847e62e9fd1cd473cc180220a379efba93f94a6 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Mon, 26 Oct 2009 16:33:04 -0700 Subject: * Switched all operations on the list of clients that could be either sync or async to use Scene.ForEachClient() instead of referencing ClientManager directly * Added a new [Startup] config option called use_async_when_possible to signal how to run operations that could be either sync or async * Changed Scene.ForEachClient to respect use_async_when_possible * Fixing a potential deadlock in Parallel.ForEach by locking on a temporary object instead of the enumerator (which may be shared across multiple invocations on ForEach). Thank you diva --- .../Region/OptionalModules/ContentManagementSystem/MetaEntity.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/OptionalModules/ContentManagementSystem') diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs index b6513e2..1a72971 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/MetaEntity.cs @@ -183,10 +183,12 @@ namespace OpenSim.Region.OptionalModules.ContentManagement public virtual void HideFromAll() { foreach (SceneObjectPart part in m_Entity.Children.Values) - m_Entity.Scene.ClientManager.ForEach( + { + m_Entity.Scene.ForEachClient( delegate(IClientAPI controller) { controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); } ); + } } public void SendFullUpdate(IClientAPI client) @@ -202,7 +204,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement public void SendFullUpdateToAll() { - m_Entity.Scene.ClientManager.ForEach( + m_Entity.Scene.ForEachClient( delegate(IClientAPI controller) { m_Entity.SendFullUpdateToClient(controller); } ); -- cgit v1.1