[Mono-dev] mono_jit_init fails when called from a Qt QThread

Robert Jordan robertj at gmx.net
Tue Aug 10 17:02:18 EDT 2010


On 10.08.2010 22:00, Frank Fuchs wrote:
> Hi,
> I think I have a rather special problem here. I have a Qt C++ application with an embedded mono jit.
> Everything works nicely so far. However, I recently tried to start the Jit from a Qthread
> (in order to have an unblocked GUI during the "C# script" execution, which can be several minutes).
> Sadly I don't even get close to execution of the assembly, since the mono_jit_init_version call fails.
> The stack trace provided by gdb is attached below. To me it looks like Qt does not play nice with pthreads as used by the GC.
> (I found something similar using QThreads and openmp together.)
> Any comments? Whose fault is it? I read something about the "new GC", would it cure this?
> BTW: system is Mac OS X 10.6.4 with mono 2.7 build from trunk.

Given that mono_jit_init() can't be called more than once per
process, you could just call it from the main thread and forget
about the issue after you've filed a bug at
http://mono-project.com/Bugs :)

The real work (compiling and executing your C# "scripts") can be
performed from a separate thread, but don't forget to call
mono_thread_attach(domain) from this thread.


More information about the Mono-devel-list mailing list