Ok so it turned out I just needed to use gchandles, my objects were getting gc'd.
Chris On Thu, Oct 10, 2013 at 11:29 PM, Chris Ochs <[email protected]> wrote: > 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 >
_______________________________________________ Mono-list maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-list
