Skip to content

The argument of mask does not always restore the masking state

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:

mask_ $ -- start with exceptions masked
mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $
  restore $ getMaskingState >>= print
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.

Edited by Facundo Domínguez
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information