Commit 5c1bad13 authored by Simon Marlow's avatar Simon Marlow

add test for #4876

parent 38643f35
import System.Random
import Control.Concurrent.SampleVar
import Control.Concurrent
import Control.Monad
produce, consume :: SampleVar Int -> IO ()
produce svar = do
b <- isEmptySampleVar svar
if b then writeSampleVar svar 3 else return ()
consume svar = readSampleVar svar >>= print
main = do
svar <- newEmptySampleVar
m <- newEmptyMVar
forkIO $ consume svar >> putMVar m ()
threadDelay 100000 -- 100 ms
produce svar
takeMVar m -- deadlocked before the fix in #4876
setTestOpts(only_compiler_types(['ghc']))
test('SampleVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('4876', normal, compile_and_run, ['']) # another SampleVar test
test('Chan001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('MVar001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
test('QSemN001', reqlib('QuickCheck'), compile_and_run, ['-package QuickCheck'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment