[GHC] #5902: Cannot tell from an exception handler whether the exception was asynchronous

GHC cvs-ghc at haskell.org
Wed Feb 29 13:30:24 CET 2012


#5902: Cannot tell from an exception handler whether the exception was
asynchronous
---------------------------------+------------------------------------------
    Reporter:  simonmar          |       Owner:  simonmar        
        Type:  bug               |      Status:  new             
    Priority:  normal            |   Milestone:  7.6.1           
   Component:  Compiler          |     Version:  7.4.1           
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * priority:  high => normal


Comment:

 After playing around with this for a while I'm not sure there's anything
 sensible we can do.  I tried passing a `Bool` to the handler in the
 primitive `catch#` to indicate whether the exception had been thrown
 asynchronously or not, but in the example I was interested in
 (`unsafeInterleaveIO getLine`, from #5866) it didn't help: the exception
 is first caught and thrown again by an inner exception handler before
 being caught by the outer exception handler.  The inner exception handler
 is not in a position to re-throw the exception asynchronously because it
 has no sensible way to resume, but the outer handler can.  In this case,
 checking whether the exception is one of the designated asynchronous
 exceptions (`ThreadKilled` etc.) works fine.

 One positive step we could take is to use the exception hierarchy properly
 and make an `AsyncException` sub-hierarchy, and put `Timeout` under it.
 This would fix the specific problem in #5866.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5902#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler



More information about the Glasgow-haskell-bugs mailing list