Multiple C threads -> one unthreaded GHC RTS

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multiple C threads -> one unthreaded GHC RTS

Albert Y. C. Lai
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.

Thanks.
_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users
Reply | Threaded
Open this post in threaded view
|

Re: Multiple C threads -> one unthreaded GHC RTS

Brandon Allbery
On Thu, Sep 28, 2017 at 4:57 PM, Albert Y. C. Lai <[hidden email]> 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
[hidden email]                                  [hidden email]
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net

_______________________________________________
Glasgow-haskell-users mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users