#5238: throwSTM+catchSTM pollutes the masking state
-----------------------------------+----------------------------------------
    Reporter:  mikhail.vorozhtsov  |        Owner:  simonmar    
        Type:  bug                 |       Status:  new         
    Priority:  high                |    Milestone:  7.2.1       
   Component:  Runtime System      |      Version:  7.1         
    Keywords:  stm                 |     Testcase:              
   Blockedby:                      |   Difficulty:              
          Os:  Unknown/Multiple    |     Blocking:              
Architecture:  Unknown/Multiple    |      Failure:  None/Unknown
-----------------------------------+----------------------------------------

Comment(by mikhail.vorozhtsov):

 Replying to [comment:2 simonmar]:
 > Is it sensible for `catchSTM` to catch asynchronous exceptions, and to
 be able to mask inside STM?

 Yes. I intend to use it like this:
 {{{
 mask $ \restore → do
   ioBefore
   atomically $ restore $ aRatherLongTransactionWithRetries
   ioAfter
 }}}
 where `mask` has type
 {{{
 MonadException µ η ⇒ ((∀ μ' η' β . MonadException μ' η' ⇒ μ' β → μ' β) → μ
 α) → μ α
 }}}
 (which basically means that it can restore the masking state in both IO
 and STM, as well as in any stack of transformers which has one of them as
 the base, via the monad-control package machinery).

 This way it would be guaranteed that if the computation is interrupted
 then the transaction is not committed.

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