}
}
}
+
+ /* Same for Volatile.Read/Write<T> */
+ {
+ MonoGenericContext ctx;
+ MonoType *args [16];
+ MonoMethod *m;
+ MonoClass *volatile_klass = mono_class_from_name (mono_defaults.corlib, "System.Threading", "Volatile");
+ gpointer iter = NULL;
+
+ while ((m = mono_class_get_methods (volatile_klass, &iter))) {
+ if ((!strcmp (m->name, "Read") || !strcmp (m->name, "Write")) && m->is_generic) {
+ memset (&ctx, 0, sizeof (ctx));
+ args [0] = &mono_defaults.object_class->byval_arg;
+ ctx.method_inst = mono_metadata_get_generic_inst (1, args);
+ add_extra_method (acfg, mono_marshal_get_native_wrapper (mono_class_inflate_generic_method (m, &ctx), TRUE, TRUE));
+ }
+ }
+ }
}
}
}
/* Same for CompareExchange<T> and Exchange<T> */
- if (method_index == 0xffffff && method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib && !strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Interlocked") && (!strcmp (method->name, "CompareExchange") || !strcmp (method->name, "Exchange")) && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1])) {
+ /* Same for Volatile.Read<T>/Write<T> */
+ if (method_index == 0xffffff && method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE && method->klass->image == mono_defaults.corlib &&
+ ((!strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Interlocked") && (!strcmp (method->name, "CompareExchange") || !strcmp (method->name, "Exchange")) && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1])) ||
+ (!strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Volatile") && (!strcmp (method->name, "Read") && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->ret))) ||
+ (!strcmp (method->klass->name_space, "System.Threading") && !strcmp (method->klass->name, "Volatile") && (!strcmp (method->name, "Write") && MONO_TYPE_IS_REFERENCE (mono_method_signature (method)->params [1]))))) {
MonoMethod *m;
MonoGenericContext ctx;
MonoType *args [16];
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
+using System.Threading;
class Tests {
return 3;
return 0;
}
+
+ public static int test_0_volatile_read_write () {
+ string foo = "ABC";
+ Volatile.Write (ref foo, "DEF");
+ return Volatile.Read (ref foo) == "DEF" ? 0 : 1;
+ }
}