[GHC] #10149: The argument of mask does not always restore the masking state

GHC ghc-devs at haskell.org
Mon Mar 9 14:10:39 UTC 2015


#10149: The argument of mask does not always restore the masking state
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  facundo.dominguez                  |            Status:  new
                  Type:  bug         |         Milestone:
              Priority:  normal      |           Version:  7.8.4
             Component:              |  Operating System:  Unknown/Multiple
  libraries/base                     |   Type of failure:  None/Unknown
              Keywords:              |        Blocked By:
          Architecture:              |   Related Tickets:
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 In the documentation of `mask` and `uninterruptibleMask` it is claimed
 that the `restore` argument restores the masking state. However this is
 not true in the following programs:

 {{{#!hs
 mask_ $ -- start with exceptions masked
 mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $
   restore $ getMaskingState >>= print
 }}}

 {{{#!hs
 uninterruptibleMask_ $ -- start with exceptions uninterruptibly masked
 uninterruptibleMask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $
   restore $ getMaskingState >>= print
 }}}

 The expected state is that `getMaskingState` would produce
 `MaskedInterruptible` and `MaskedUninterruptible`, however, in both cases
 it gives Unmasked.

 Either the documentation needs to be changed, or the implementation must
 really restore the masking state in these cases.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10149>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list