Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
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