[Mono-list] MonoObject reference changing to other object type

Chris Ochs chris at ochsnet.com
Fri Oct 11 06:29:03 UTC 2013


I'm embedding mono and it's in a threaded environment so was hoping that a
simple explanation of what I'm doing might shed some light on where I am
going wrong, before I post the code.

I'm embedding in java 7 via the jruby ffi.  I have a C function that calls
mono_object_new and returns it as a pointer to jruby.  Some time later I
call another C function with the MonoObject, and when I call
mono_class_get_name on the object's klass, I get back random classes.  My
function that creates the MonoObject is hard wired to a specific
namespace/class.  I'd say roughly 20% of the time I get back a random
class, it's not always the same.

The threading involved comes from Akka.  I am creating the mono object in
one thread and usually using it in another, but never is a mono object used
concurrently by different threads.  I'm also using mono_thread_attach
liberally at this point.

Anything obvious that sticks out?  Seems like a threading issue of some
type.  If I'm missing a call to mono_thread_attach somewhere, would this
behavior be expected?

Chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-list/attachments/20131010/38c48c85/attachment.html>


More information about the Mono-list mailing list