[GHC] #8818: Add withMVarMasked
#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
#8818: Add withMVarMasked -------------------------------------+------------------------------------ Reporter: hvr | Owner: hvr Type: feature request | Status: new Priority: normal | Milestone: 7.10.1 Component: libraries/base | Version: Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Comment (by Herbert Valerio Riedel <hvr@…>): In [changeset:"2d5471cd3ee42406042a030424a1a83308a170fa/base"]: {{{ #!CommitTicketReference repository="base" revision="2d5471cd3ee42406042a030424a1a83308a170fa" Add `withMVarMasked` (re #8818) Like `withMVar`, but the @IO@ action in the second argument is executed with asynchronous exceptions masked. This completes the `MVar` API, which already contained `modifyMVarMasked` and `modifyMVarMasked_`. Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org> }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8818#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#8818: Add withMVarMasked -------------------------------------+------------------------------------ Reporter: hvr | Owner: hvr Type: feature request | Status: closed Priority: normal | Milestone: 7.8.1 Component: libraries/base | Version: Resolution: fixed | Keywords: Operating System: Unknown/Multiple | Architecture: Unknown/Multiple Type of failure: None/Unknown | Difficulty: Unknown Test Case: | Blocked By: Blocking: | Related Tickets: -------------------------------------+------------------------------------ Changes (by hvr): * status: new => closed * resolution: => fixed * milestone: 7.10.1 => 7.8.1 Comment: I went ahead with this (after simonmar confirmed to me on IRC this addition made sense). Also, this has been merged in the ghc-7.8 branch via [a91d68221ca30/base] -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8818#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC