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
C-threads & callbacks
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-01-20 (18:58)
From: Daniel_Bünzli <daniel.buenzli@e...>
Subject: Re: [Caml-list] C-threads & callbacks
> As it seems, it is not possible to run OCaml-code linked with thread
> support while letting C-threads perform callbacks.  This has already
> been a topic on the list a while ago.

I don't understand what you are refering to. I don't think there's a 
problem as long as you take care to acquire ocaml's global lock to 
exectue the callbacks.

#include <caml/signals.h>
...
caml_leave_blocking_section();
callback(*caml_named_value("myfun"), Val_unit);
caml_enter_blocking_section();
...

This ensures that callbacks into caml are properly serialized.

Daniel