X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=doc%2Fembedded-api;h=62c62c6180db0b446507abb38cb7665ad89fa632;hb=37908f265fc3ef2737261b0c28281a8389232183;hp=12e0c30450b4b239c476f9d1c04985890231420d;hpb=4bea1529ce021a109412674323107e0be8b8faaf;p=mono.git diff --git a/doc/embedded-api b/doc/embedded-api index 12e0c30450b..62c62c6180d 100755 --- a/doc/embedded-api +++ b/doc/embedded-api @@ -68,9 +68,20 @@ not interfere with code in other domains. This is useful if you want to host different applications in your program. - Then you can load an assembly containing code into the domain: + Now, it is necessary to transfer control to Mono, and setup + the threading infrastructure, you do this like this:
+		void *user_data = NULL;
+
+		mono_runtime_exec_managed_code (domain, main_thread_handler, user_data);
+	
+ + Where your main_thread_handler can load your assembly and execute it: + +
+	static void main_thread_handler (gpointer user_data)
+	{	
 		MonoAssembly *assembly;
 
 		assembly = mono_domain_assembly_open (domain, "file.dll");
@@ -107,7 +118,7 @@
 
 	The Boehm GC system needs to catch your calls to the pthreads
 	layer, so in each file where you use pthread.h you should
-	include the  file.  
+	include the <gc/gc.h> file.  
 
 * Exposing C code to the CIL universe
 
@@ -273,6 +284,15 @@
 	It may not be possible to manage exceptions in that case,
 	though. I need to think more about it.
 
+** Threading issues
+
+	If your application creates threads on its own, and you want them to 
+	be able to call code into the CIL universe with Mono, you have to
+	register the thread with Mono before issuing the call.
+
+	To do so, call the mono_thread_attach() function before you execute
+	any managed code from the thread
+
 * Samples
 
 	See the sample programs in mono/sample/embed for examples of