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

GHC ghc-devs at haskell.org
Mon Mar 9 14:11:27 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:  libraries/base    |                Keywords:
      Resolution:                    |            Architecture:
Operating System:  Unknown/Multiple  |  Unknown/Multiple
 Type of failure:  None/Unknown      |               Test Case:
      Blocked By:                    |                Blocking:
 Related Tickets:                    |  Differential Revisions:
-------------------------------------+-------------------------------------
Description changed by facundo.dominguez:

Old description:

> 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.

New description:

 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 result 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#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list