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 --- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index ac89f7b..cfe32d0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -408,7 +408,7 @@ namespace OpenSim.Region.Framework.Scenes } ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray(); - ClientManager.ForEach( + ForEachClient( delegate(IClientAPI client) { if (client.AgentId != remoteClient.AgentId) -- cgit v1.1 From c75d4156487b35aac47aa6818144862a99bb841c Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Tue, 27 Oct 2009 00:26:56 -0700 Subject: * Converts ClientManager.ForEach() (and as a result, Scene.ForEachClient()) to use a non-blocking parallel method when operating in async mode * Minor code readability cleanup --- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index cfe32d0..1a91f0c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -394,7 +394,7 @@ namespace OpenSim.Region.Framework.Scenes void ProcessViewerEffect(IClientAPI remoteClient, List args) { // TODO: don't create new blocks if recycling an old packet - List effectBlock = new List(); + ViewerEffectPacket.EffectBlock[] effectBlockArray = new ViewerEffectPacket.EffectBlock[args.Count]; for (int i = 0; i < args.Count; i++) { ViewerEffectPacket.EffectBlock effect = new ViewerEffectPacket.EffectBlock(); @@ -404,9 +404,8 @@ namespace OpenSim.Region.Framework.Scenes effect.ID = args[i].ID; effect.Type = args[i].Type; effect.TypeData = args[i].TypeData; - effectBlock.Add(effect); + effectBlockArray[i] = effect; } - ViewerEffectPacket.EffectBlock[] effectBlockArray = effectBlock.ToArray(); ForEachClient( delegate(IClientAPI client) -- cgit v1.1