From: "Daniel Bünzli" <daniel.buenzli@epfl.ch>
To: Christophe Raffalli <Christophe.Raffalli@univ-savoie.fr>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Scheduling thread problem kernel 2.6
Date: Wed, 14 Apr 2004 10:11:02 +0200 [thread overview]
Message-ID: <44F959F8-8DEB-11D8-A972-000393DBC266@epfl.ch> (raw)
In-Reply-To: <407CD31D.5080001@univ-savoie.fr>
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
like
#include <caml/signals.h>
CAMLprim value ocaml_glutMainLoop(value v)
{
enter_blocking_section();
glutMainLoop();
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,
...
leave_blocking_section();
callback(*caml_named_value("myfun"), Val_unit);
enter_blocking_section();
...
See also this message
<http://caml.inria.fr/archives/200106/msg00199.html>
Hope that helps,
Daniel
-------------------
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
next prev parent reply other threads:[~2004-04-14 8:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-04-13 7:57 Christophe Raffalli
2004-04-13 19:48 ` David Brown
2004-04-14 5:58 ` Christophe Raffalli
2004-04-14 8:11 ` Daniel Bünzli [this message]
2004-04-14 9:21 ` Christophe Raffalli
2004-04-14 11:46 ` Daniel Bünzli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44F959F8-8DEB-11D8-A972-000393DBC266@epfl.ch \
--to=daniel.buenzli@epfl.ch \
--cc=Christophe.Raffalli@univ-savoie.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox