diff options
author | Edward Z. Yang <ezyang@mit.edu> | 2013-07-10 13:37:20 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@mit.edu> | 2013-07-10 13:37:20 -0700 |
commit | ca3a648bcc98b9b526e2f2bb04cf91dd8dfe40c0 (patch) | |
tree | 4bf2236ab245894a86baba289e75a47dd08ee2c4 /testsuite/tests/concurrent | |
parent | d8b1626f078c3d859a99700ed0a354be2560f6ab (diff) | |
download | haskell-ca3a648bcc98b9b526e2f2bb04cf91dd8dfe40c0.tar.gz |
Add simple test for tryAtomicReadMVar.
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
Diffstat (limited to 'testsuite/tests/concurrent')
-rw-r--r-- | testsuite/tests/concurrent/should_run/all.T | 1 | ||||
-rw-r--r-- | testsuite/tests/concurrent/should_run/tryAtomicReadMVar1.hs | 11 |
2 files changed, 12 insertions, 0 deletions
diff --git a/testsuite/tests/concurrent/should_run/all.T b/testsuite/tests/concurrent/should_run/all.T index 5665764fbc..1b729fac8f 100644 --- a/testsuite/tests/concurrent/should_run/all.T +++ b/testsuite/tests/concurrent/should_run/all.T @@ -77,6 +77,7 @@ test('T5866', exit_code(1), compile_and_run, ['']) test('atomicReadMVar1', normal, compile_and_run, ['']) test('atomicReadMVar2', normal, compile_and_run, ['']) test('atomicReadMVar3', normal, compile_and_run, ['']) +test('tryAtomicReadMVar1', normal, compile_and_run, ['']) # ----------------------------------------------------------------------------- # These tests we only do for a full run diff --git a/testsuite/tests/concurrent/should_run/tryAtomicReadMVar1.hs b/testsuite/tests/concurrent/should_run/tryAtomicReadMVar1.hs new file mode 100644 index 0000000000..387dde3dd0 --- /dev/null +++ b/testsuite/tests/concurrent/should_run/tryAtomicReadMVar1.hs @@ -0,0 +1,11 @@ +module Main where + +import GHC.MVar +import Control.Concurrent + +main = do + m <- newMVar (0 :: Int) + Just 0 <- tryAtomicReadMVar m + takeMVar m + Nothing <- tryAtomicReadMVar m + return () |