#2558: re-throwing an asynchronous exception throws it synchronously
---------------------------------+------------------------------------------
    Reporter:  simonmar          |        Owner:  simonmar        
        Type:  bug               |       Status:  new             
    Priority:  normal            |    Milestone:  6.12 branch     
   Component:  Compiler          |      Version:  6.8.3           
    Severity:  normal            |   Resolution:                  
    Keywords:                    |   Difficulty:  Unknown         
    Testcase:                    |           Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |  
---------------------------------+------------------------------------------
Comment (by simonmar):

 Replying to [comment:5 int-e]:
 > My first instinct would be to pass a flag to exception handlers
 (changing the type of the {{{catch#}}} primitive, and the stack frame
 creation in {{{RaiseAsync.c}}} and {{{Exception.cmm}}} accordingly) to
 sort out at their leisure. Igloo's idea is similar in that would also pass
 a flag along with the exception, although the flag is set at a different
 point. I'm not sure which is easier to accomplish.
 >
 > It's already possible to use such a flag:
 > {{{
 > throwAsync :: Exception e => e -> IO ()
 > throwAsync e = do
 >     target <- myThreadId
 >     throwTo target e
 >
 > throwSyncOrAsync :: Exception e => Bool -> e -> IO ()
 > throwSyncOrAsync async = if async then throwAsync else throwIO
 > }}}

 Good point - and so a partial workaround for this bug is to always throw
 asynchronous exceptions like `ThreadKilled` using `throwAsync`.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2558#comment:8>
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

Reply via email to