Threaded foreign functions calling back.

Peter Strand d98peter at
Sat Sep 27 15:23:44 EDT 2003


I'd like to use a C-library which calls back into the haskell
program, potentially from different threads at the same time.

That is, the following calling sequence takes place:
 (haskell) Calls C via foreign import.
 (c)       Creates threads, which in turn calls back into
           haskell via foreign exported functions.

Is this supported in ghc?

Some simple tests suggests that it does work, at least I don't
get any crashes, if ghc is compiled with --enable-threaded-rts. 
But is this intended to work or am I just lucky?


More information about the Glasgow-haskell-users mailing list