// 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)]
[CLSCompliant (false)]
[MethodImplAttribute (MethodImplOptions.InternalCall)]
- extern public static byte VolatileRead (ref UIntPtr address);
+ extern public static UIntPtr VolatileRead (ref UIntPtr address);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern public static void VolatileWrite (ref byte address, byte value);