[GHC] #2558: re-throwing an asynchronous exception throws it synchronously

GHC trac at galois.com
Thu Jan 8 12:44:37 EST 2009


#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 int-e):

 Replying to [comment:9 Isaac]:
 > nitpick: what if throwAsync is called when in blocked mode? does it need
 to do `unblock (throwTo target e)` in order for the self-exception to
 arrive? (or maybe the RTS already side-steps this deadlock?)

 Currently, the exception gets delivered, even in blocked mode.

 There's actually a todo in {{{Exception.cmm}}} for that case:
 {{{
     if (target == CurrentTSO) {
         SAVE_THREAD_STATE();
         /* ToDo: what if the current thread is blocking exceptions? */
         foreign "C" throwToSingleThreaded(MyCapability() "ptr",
                                           target "ptr", exception
 "ptr")[R1,R2];
 }}}

 I'd say that the current behaviour is sensible: {{{throwTo}}} is a
 blocking operation. As soon as the thread blocks on itself, it can deliver
 its own exception. We may just as well skip the step of getting blocked.

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


More information about the Glasgow-haskell-bugs mailing list