From 2501372d3b7623715d443d41f9d85a5f416ec1b1 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 18 Sep 2010 01:57:13 +0100 Subject: [PATCH] Add m_syncRoot lock to MapAndArray.ContainsKey(), as discussed with jhurliman Though this is actually thread-safe on .net 4.0 and mono today, the .net sdk states that Dictionary instance members are not guaranteed thread-safe --- OpenSim/Framework/MapAndArray.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/MapAndArray.cs b/OpenSim/Framework/MapAndArray.cs index bbe6a9e28e..c98d3ccd6f 100644 --- a/OpenSim/Framework/MapAndArray.cs +++ b/OpenSim/Framework/MapAndArray.cs @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) Contributors, http://opensimulator.org/ * See CONTRIBUTORS.TXT for a full list of copyright holders. * @@ -131,7 +131,8 @@ namespace OpenSim.Framework /// True if the key was found, otherwise false public bool ContainsKey(TKey key) { - return m_dict.ContainsKey(key); + lock (m_syncRoot) + return m_dict.ContainsKey(key); } ///