
#8818: Add withMVarMasked ------------------------------------+------------------------------------- Reporter: hvr | Owner: hvr Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: Keywords: | Operating System: Unknown/Multiple Architecture: Unknown/Multiple | Type of failure: None/Unknown Difficulty: Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | ------------------------------------+------------------------------------- We already have `modifyMVarMasked` and `modifyMVarMasked_`, and so I propose to add {{{#!haskell {-| Like 'withMVar', but the @IO@ action in the second argument is executed with asynchronous exceptions masked. /Since: 4.7.0.0/ -} {-# INLINE withMVarMasked_ #-} withMVarMasked :: MVar a -> (a -> IO b) -> IO b withMVarMasked m io = mask_ $ do a <- takeMVar m b <- io a `onException` putMVar m a putMVar m a return b }}} any arguments against this addition? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/8818 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler