diff --git a/tests/T16707.hs b/tests/T16707.hs new file mode 100644 index 0000000..61e723c --- /dev/null +++ b/tests/T16707.hs @@ -0,0 +1,20 @@ +import Control.Concurrent +import Control.Concurrent.STM +import Debug.Trace + +main :: IO () +main = (`mapM_` [1..1000]) $ \_ -> do + traceEventIO "((((" + + x <- newTVarIO False + + forkIO $ atomically $ writeTVar x True + + traceEventIO "----" + + atomically $ do -- hangs in the second iteration + _ <- readTVar x + writeTVar x True `orElse` return () + + threadDelay 100000 + traceEventIO "))))" diff --git a/tests/all.T b/tests/all.T index c1138fa..2bc0f69 100644 --- a/tests/all.T +++ b/tests/all.T @@ -26,3 +26,4 @@ test('stm065', normal, compile_and_run, ['-package stm']) test('cloneTChan001', normal, compile_and_run, ['-package stm']) test('T15136', extra_run_opts('20'), compile_and_run, ['-package stm']) +test('T16707', normal, compile_and_run, [''])