+2004-07-15 Dick Porter <dick@ximian.com>
+
+ * Thread.cs: Hold a lock in GetNamedDataSlot. Fixes bug 61582,
+ based on patch by Sébastien Robitaille
+ (sebastien.robitaille@croesus.com). Also fix instances of
+ lock(typeof(Thread)) to lock a private object instead.
+
2004-07-14 Sebastien Pouliot <sebastien@ximian.com>
* AsyncFlowControl.cs: New structure in Fx 2.0 required in
// Stores a hash keyed by strings of LocalDataStoreSlot objects
static Hashtable datastorehash;
-
+ private static object datastore_lock = new object ();
+
private static void InitDataStoreHash () {
- lock (typeof (Thread)) {
+ lock (datastore_lock) {
if (datastorehash == null) {
datastorehash = Hashtable.Synchronized(new Hashtable());
}
}
public static LocalDataStoreSlot AllocateNamedDataSlot(string name) {
- lock (typeof (Thread)) {
+ lock (datastore_lock) {
if (datastorehash == null)
InitDataStoreHash ();
LocalDataStoreSlot slot = (LocalDataStoreSlot)datastorehash[name];
}
public static void FreeNamedDataSlot(string name) {
- lock (typeof (Thread)) {
+ lock (datastore_lock) {
if (datastorehash == null)
InitDataStoreHash ();
LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
public extern static int GetDomainID();
public static LocalDataStoreSlot GetNamedDataSlot(string name) {
- if (datastorehash == null)
- InitDataStoreHash ();
- LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
+ lock (datastore_lock) {
+ if (datastorehash == null)
+ InitDataStoreHash ();
+ LocalDataStoreSlot slot=(LocalDataStoreSlot)datastorehash[name];
- if(slot==null) {
- slot=AllocateNamedDataSlot(name);
- }
+ if(slot==null) {
+ slot=AllocateNamedDataSlot(name);
+ }
- return(slot);
+ return(slot);
+ }
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
public CultureInfo CurrentCulture {
get {
if (current_culture == null) {
- lock (typeof (Thread)) {
+ lock (synch_lock) {
if(current_culture==null) {
if(in_currentculture==true) {
/* Bail out */