Interruptible foreign calls, part 2

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

Interruptible foreign calls, part 2

David Feuer
Another issue is that (as the recently expanded documentation shows),
an `interruptible` foreign call is not actually an "interruptible
operation" in the sense used in Control.Exception. To make it so, the
caller has to manually call `allowInterrupt`. Or, in the
single-threaded runtime, has to call `interruptibleYield`. So ... they
have to make a foreign call to `rts_isThreaded` and then use the
result to figure out how to deliver a potential exception. What a
terrible user experience! Why not bake the "deliver exceptions" part
into the FFI code for `interruptible` calls? This stuff has been
documented so very recently (not in any released GHC) that I don't
imagine much will break if we make these changes.
_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs
Reply | Threaded
Open this post in threaded view
|

Re: Interruptible foreign calls, part 2

David Feuer
Whoops, I meant `interruptible yield`. Sorry for the confusion.

On Mon, Jan 4, 2021, 1:22 AM David Feuer <[hidden email]> wrote:
Another issue is that (as the recently expanded documentation shows),
an `interruptible` foreign call is not actually an "interruptible
operation" in the sense used in Control.Exception. To make it so, the
caller has to manually call `allowInterrupt`. Or, in the
single-threaded runtime, has to call `interruptibleYield`. So ... they
have to make a foreign call to `rts_isThreaded` and then use the
result to figure out how to deliver a potential exception. What a
terrible user experience! Why not bake the "deliver exceptions" part
into the FFI code for `interruptible` calls? This stuff has been
documented so very recently (not in any released GHC) that I don't
imagine much will break if we make these changes.

_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs