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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-08-12 (17:24)
From: Olivier Andrieu <andrieu@i...>
Subject: [Caml-list] Threaded C code and callbacks

There's a C library I'd like to interface with ocaml but it is
multithreaded.  In the API, one can set some callbacks that are called
asynchronously.  Of course, I'd like these callbacks to be caml
functions.  The problem is that I cannot simply use `callback_exn'
because when the callback is triggered another caml thread may be 
running ; callback_exn doesn't seem to check the mutex (or whatever)
that guarantees that only one caml thread is running. 

I tried various hacks involving some mutex shared by caml and the C
stub code but it stills crashes at some point.

Any idea ? Or is this definitively impossible ? (I'm not very familiar
with the internal's of ocaml's threading machinery).

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: