Wed Mar 15 16:35:13 CET 2006 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Wed, 15 Mar 2006 15:39:20 +0000 (15:39 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Wed, 15 Mar 2006 15:39:20 +0000 (15:39 -0000)
* Context.cs: update for LocalDataStoreSlot changes.

svn path=/trunk/mcs/; revision=58021

mcs/class/corlib/System.Runtime.Remoting.Contexts/ChangeLog
mcs/class/corlib/System.Runtime.Remoting.Contexts/Context.cs

index 262b22082e2089b405abd544c04ddf3a7707f5ae..269ff91aa863f0edcc20277196ae17b6b438a85d 100644 (file)
@@ -1,3 +1,8 @@
+
+Wed Mar 15 16:35:13 CET 2006 Paolo Molaro <lupus@ximian.com>
+
+       * Context.cs: update for LocalDataStoreSlot changes.
+
 2006-01-31  Lluis Sanchez Gual  <lluis@novell.com>
 
        * Context.cs: Fixed double check lock.
index 4c7c2fa7d32186234a3992c8997e7c2b2b8332d1..4c30ecfb5528839d08e340b671646b51961d71b8 100644 (file)
@@ -59,7 +59,7 @@ namespace System.Runtime.Remoting.Contexts {
                // The sink chain that has to be used by all calls exiting the context
                IMessageSink client_context_sink_chain = null;
 
-               Hashtable datastore;
+               object[] datastore;
                ArrayList context_properties;
                bool frozen;
                
@@ -345,14 +345,14 @@ namespace System.Runtime.Remoting.Contexts {
                
                public static LocalDataStoreSlot AllocateDataSlot ()
                {
-                       return new LocalDataStoreSlot ();
+                       return new LocalDataStoreSlot (false);
                }
                
                public static LocalDataStoreSlot AllocateNamedDataSlot (string name)
                {
                        lock (namedSlots.SyncRoot)
                        {
-                               LocalDataStoreSlot slot = new LocalDataStoreSlot ();
+                               LocalDataStoreSlot slot = AllocateDataSlot ();
                                namedSlots.Add (name, slot);
                                return slot;
                        }
@@ -372,8 +372,9 @@ namespace System.Runtime.Remoting.Contexts {
                        
                        lock (ctx)
                        {
-                               if (ctx.datastore == null) return null;
-                               return ctx.datastore [slot];
+                               if (ctx.datastore != null && slot.slot < ctx.datastore.Length)
+                                       return ctx.datastore [slot.slot];
+                               return null;
                        }
                }
                
@@ -392,9 +393,14 @@ namespace System.Runtime.Remoting.Contexts {
                        Context ctx = Thread.CurrentContext;
                        lock (ctx)
                        {
-                               if (ctx.datastore == null)
-                                       ctx.datastore = new Hashtable ();
-                               ctx.datastore [slot] = data;
+                               if (ctx.datastore == null) {
+                                       ctx.datastore = new object [slot.slot + 2];
+                               } else if (slot.slot >= ctx.datastore.Length) {
+                                       object[] nslots = new object [slot.slot + 2];
+                                       ctx.datastore.CopyTo (nslots, 0);
+                                       ctx.datastore = nslots;
+                               }
+                               ctx.datastore [slot.slot] = data;
                        }
                }
        }