On Thu, Sep 28, 2017 at 4:57 PM, Albert Y. C. Lai <trebla@vex.net> wrote:
Suppose I have a C program with multiple C threads calling Haskell functions, maybe the same Haskell function too, and the GHC RTS used is the unthreaded one. What will go wrong?

I ask because Cabal/cabal-install has recently added building of export-to-C shared libraries, i.e., the "foreign-library" section. It sees to all the technical details, very nice, I'm very happy about this addition, but it chooses the unthreaded GHC RTS.

I don't expect the unthreaded RTS to be reentrant, so would expect you to need locking around calls into it to avoid the dreaded 'scheduler entered unsafely!' RTS error. And thread-local storage might be an issue.

--
brandon s allbery kf8nh                               sine nomine associates
allbery.b@gmail.com                                  ballbery@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net