Interruptible foreign calls, part 2

David Feuer david.feuer at gmail.com
Mon Jan 4 06:22:54 UTC 2021


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.


More information about the ghc-devs mailing list