summaryrefslogtreecommitdiff
path: root/libraries/base/tests/T10149.hs
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/tests/T10149.hs')
-rw-r--r--libraries/base/tests/T10149.hs19
1 files changed, 19 insertions, 0 deletions
diff --git a/libraries/base/tests/T10149.hs b/libraries/base/tests/T10149.hs
new file mode 100644
index 0000000000..d15b0d766a
--- /dev/null
+++ b/libraries/base/tests/T10149.hs
@@ -0,0 +1,19 @@
+import Control.Concurrent
+import Control.Exception
+
+main :: IO ()
+main = do
+ mask $ \unmask -> mask $ \restore ->
+ unmask $ restore $ getMaskingState >>= print
+ uninterruptibleMask $ \unmask -> uninterruptibleMask $ \restore ->
+ unmask $ restore $ getMaskingState >>= print
+
+ mv <- newEmptyMVar
+ mask_ $ -- start with exceptions masked
+ mask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $
+ restore $ getMaskingState >>= print >> putMVar mv ()
+ takeMVar mv
+ uninterruptibleMask_ $ -- start with exceptions uninterruptibly masked
+ uninterruptibleMask $ \restore -> forkIOWithUnmask $ \unmask -> unmask $
+ restore $ getMaskingState >>= print >> putMVar mv ()
+ takeMVar mv