summaryrefslogtreecommitdiff
path: root/libraries/base/tests
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/base/tests')
-rw-r--r--libraries/base/tests/T10149.hs19
-rw-r--r--libraries/base/tests/T10149.stdout4
-rw-r--r--libraries/base/tests/all.T1
3 files changed, 24 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
diff --git a/libraries/base/tests/T10149.stdout b/libraries/base/tests/T10149.stdout
new file mode 100644
index 0000000000..f78328dd88
--- /dev/null
+++ b/libraries/base/tests/T10149.stdout
@@ -0,0 +1,4 @@
+MaskedInterruptible
+MaskedUninterruptible
+MaskedInterruptible
+MaskedUninterruptible
diff --git a/libraries/base/tests/all.T b/libraries/base/tests/all.T
index f53ad0cb80..00b653b64e 100644
--- a/libraries/base/tests/all.T
+++ b/libraries/base/tests/all.T
@@ -209,3 +209,4 @@ test('T9848',
, only_ways(['normal'])],
compile_and_run,
['-O'])
+test('T10149',normal, compile_and_run,[''])