diff options
Diffstat (limited to 'mcs/class/corlib/System.Threading/Thread.cs')
-rwxr-xr-x | mcs/class/corlib/System.Threading/Thread.cs | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/mcs/class/corlib/System.Threading/Thread.cs b/mcs/class/corlib/System.Threading/Thread.cs index 911fb1dbe12..66826e12d40 100755 --- a/mcs/class/corlib/System.Threading/Thread.cs +++ b/mcs/class/corlib/System.Threading/Thread.cs @@ -157,10 +157,9 @@ namespace System.Threading // Stores a hash keyed by strings of LocalDataStoreSlot objects static Hashtable datastorehash; - private static object datastore_lock = new object (); - + private static void InitDataStoreHash () { - lock (datastore_lock) { + lock (typeof (Thread)) { if (datastorehash == null) { datastorehash = Hashtable.Synchronized(new Hashtable()); } @@ -168,7 +167,7 @@ namespace System.Threading } public static LocalDataStoreSlot AllocateNamedDataSlot(string name) { - lock (datastore_lock) { + lock (typeof (Thread)) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name]; @@ -187,7 +186,7 @@ namespace System.Threading } public static void FreeNamedDataSlot(string name) { - lock (datastore_lock) { + lock (typeof (Thread)) { if (datastorehash == null) InitDataStoreHash (); LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; @@ -211,17 +210,15 @@ namespace System.Threading public extern static int GetDomainID(); public static LocalDataStoreSlot GetNamedDataSlot(string name) { - lock (datastore_lock) { - if (datastorehash == null) - InitDataStoreHash (); - LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; + if (datastorehash == null) + InitDataStoreHash (); + LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name]; - if(slot==null) { - slot=AllocateNamedDataSlot(name); - } - - return(slot); + if(slot==null) { + slot=AllocateNamedDataSlot(name); } + + return(slot); } [MethodImplAttribute(MethodImplOptions.InternalCall)] |