Skip to content

Commit 5c1bb4a

Browse files
committed
testsuite: Add test for ghc#16707
1 parent b3e299c commit 5c1bb4a

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

tests/T16707.hs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import Control.Concurrent
2+
import Control.Concurrent.STM
3+
import Debug.Trace
4+
5+
main :: IO ()
6+
main = (`mapM_` [1..1000]) $ \_ -> do
7+
traceEventIO "(((("
8+
9+
x <- newTVarIO False
10+
11+
forkIO $ atomically $ writeTVar x True
12+
13+
traceEventIO "----"
14+
15+
atomically $ do -- hangs in the second iteration
16+
_ <- readTVar x
17+
writeTVar x True `orElse` return ()
18+
19+
threadDelay 100000
20+
traceEventIO "))))"

tests/all.T

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ test('stm065', normal, compile_and_run, ['-package stm'])
2626
test('cloneTChan001', normal, compile_and_run, ['-package stm'])
2727

2828
test('T15136', extra_run_opts('20'), compile_and_run, ['-package stm'])
29+
test('T16707', normal, compile_and_run, [''])

0 commit comments

Comments
 (0)