summaryrefslogtreecommitdiff
path: root/testsuite/tests/concurrent/should_run/T13916.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/concurrent/should_run/T13916.hs')
-rwxr-xr-xtestsuite/tests/concurrent/should_run/T13916.hs33
1 files changed, 33 insertions, 0 deletions
diff --git a/testsuite/tests/concurrent/should_run/T13916.hs b/testsuite/tests/concurrent/should_run/T13916.hs
new file mode 100755
index 0000000000..e81aabb5a8
--- /dev/null
+++ b/testsuite/tests/concurrent/should_run/T13916.hs
@@ -0,0 +1,33 @@
+module Main where
+
+import Data.IORef
+import System.IO.Unsafe
+import Control.Concurrent.STM
+import Control.Concurrent.Async
+import Control.Concurrent
+import System.IO
+import System.Directory
+import System.FilePath
+import T13916_Bracket
+
+type Thing = MVar Bool
+
+main :: IO ()
+main = do
+ withEnvCache limit spawner $ \cache ->
+ forConcurrently_ [1..1000 :: Int] $ \n -> withEnv cache (\handle -> put handle n)
+ where
+ limit :: Limit
+ limit = Hard 1
+
+ put handle n = return ()
+
+spawner :: Spawner Thing
+spawner = Spawner
+ { maker = mkhandle
+ , killer = \thing -> takeMVar thing >> putMVar thing True
+ , isDead = \thing -> readMVar thing
+ }
+
+mkhandle :: IO Thing
+mkhandle = newMVar False