Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

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 Archives:
Bug reports: FAQ:
Beginner's list: