Multiple C threads -> one unthreaded GHC RTS

Brandon Allbery allbery.b at gmail.com
Thu Sep 28 21:08:16 UTC 2017


On Thu, Sep 28, 2017 at 4:57 PM, Albert Y. C. Lai <trebla at 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 at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/glasgow-haskell-users/attachments/20170928/6853aca5/attachment.html>


More information about the Glasgow-haskell-users mailing list