Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs')
-rw-r--r--mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs17
1 files changed, 12 insertions, 5 deletions
diff --git a/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
index 4c7c2fa7d32..40dd572d254 100644
--- a/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
+++ b/mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs
@@ -369,10 +369,10 @@ namespace System.Runtime.Remoting.Contexts {
public static object GetData (LocalDataStoreSlot slot)
{
Context ctx = Thread.CurrentContext;
+ if (ctx.datastore == null) return null;
- lock (ctx)
+ lock (ctx.datastore.SyncRoot)
{
- if (ctx.datastore == null) return null;
return ctx.datastore [slot];
}
}
@@ -390,10 +390,17 @@ namespace System.Runtime.Remoting.Contexts {
public static void SetData (LocalDataStoreSlot slot, object data)
{
Context ctx = Thread.CurrentContext;
- lock (ctx)
+ if (ctx.datastore == null)
+ {
+ lock (ctx)
+ {
+ if (ctx.datastore == null)
+ ctx.datastore = new Hashtable ();
+ }
+ }
+
+ lock (ctx.datastore.SyncRoot)
{
- if (ctx.datastore == null)
- ctx.datastore = new Hashtable ();
ctx.datastore [slot] = data;
}
}