#2558: re-throwing an asynchronous exception throws it synchronously
---------------------------------+------------------------------------------
Reporter: simonmar | Owner: simonmar
Type: bug | Status: new
Priority: normal | Milestone: 6.14.1
Component: Compiler | Version: 6.8.3
Keywords: | Difficulty: Unknown
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by simonmar):
I realised while thinking about this recently that the proposal in the
ticket doesn't make sense. We can't make `throw :: Exception -> a` throw
an asynchronous exception, because its value is bottom; there's nothing
sensible to do on resumption other than throw the same exception.
Similarly, it doesn't make sense for something like `finally` or
`onException` to re-throw an exception asynchronously, because we have no
way to decide what to do when the computation is resumed (e.g. inside
`unsafePerformIO`).
You can code up re-throwing of asynchronous exceptions manually using
`throwTo` to throw to the current thread, which works fine because on
resumption the behaviour is just as if `throwTo` had returned, but the
caller has to have a plan for what to do in this event - which might be
redoing the original IO operation, or it might be something else.
See #3997 for an instance of this issue that affects lazy I/O.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2558#comment:14>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs