English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
[Caml-list] Scheduling thread problem kernel 2.6
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-04-14 (08:10)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] Scheduling thread problem kernel 2.6

Le 14 avr. 04, ŕ 07:58, Christophe Raffalli a écrit :

> I do not understand ? First I launch the interface thread from Caml 
> with
> Thread.create and the interface thread calls Glut.main_loop which 
> never ends (except when the program terminates). This main loop call 
> some Caml functions.

My understanding is that the Glut.main_loop stub should be something 

#include <caml/signals.h>

CAMLprim value ocaml_glutMainLoop(value v)
	leave_blocking_section(); /* This will in fact never be called */
	return Val_unit;

enter_blocking_section() releases the master mutex that ensures single 
threaded execution of caml code and allows other caml threads to 
proceed. Now each callback calling back from C into caml should 
reacquire the master lock to avoid concurrent execution of caml code. 
To do so callbacks from C into caml should be wrapped as follows,

callback(*caml_named_value("myfun"), Val_unit);

See also this message


Hope that helps,

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners