[Mono-list] Mono embedding and threads
Paolo Molaro
lupus@ximian.com
Tue, 8 Oct 2002 16:47:47 +0200
On 10/08/02 George Kodinov wrote:
> I'm trying to embed the Mono runtime into a Linux pthreads application
> (so it can execute multiple managed code instances independantly).
> What is the correct way of going about it ?
> Can I for example create multiple instances of the Mono runtime
> (mono_jit_init) ?
No. mono_jit_init() should be called only once.
You should be able to create separate domains if needed and execute
code in them. It's probably easier to initiate this from within C# code,
since I don't think there's an easy to use API to do it from C, yet.
If you need multiple managed threads, I suggest starting them from C#
code, too.
> Are there any special considerations/function wrappers re. Boehm GC usage ?
The Boehm GC needs to intercept a few pthread calls: you just need
to include the gc.h header file in every C file that uses the pthread
calls and then you need to compile your program with an additional
#define (according to the OS, it's -DGC_LINUX_THREADS on linux).
lupus
--
-----------------------------------------------------------------
lupus@debian.org debian/rules
lupus@ximian.com Monkeys do it better