diff options
Diffstat (limited to 'testsuite/tests/rts/pause-resume/shouldfail/rts_lock_when_paused.hs')
-rw-r--r-- | testsuite/tests/rts/pause-resume/shouldfail/rts_lock_when_paused.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/testsuite/tests/rts/pause-resume/shouldfail/rts_lock_when_paused.hs b/testsuite/tests/rts/pause-resume/shouldfail/rts_lock_when_paused.hs new file mode 100644 index 0000000000..7ca1107211 --- /dev/null +++ b/testsuite/tests/rts/pause-resume/shouldfail/rts_lock_when_paused.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE ForeignFunctionInterface #-} + +import Control.Concurrent +import Foreign +import Foreign.C +import System.Exit +import System.Timeout + +foreign import ccall safe "rts_pause_lock.h assertDoneAfterOneSecond" + safe_assertDoneAfterOneSecond_c :: Ptr CInt -> IO () + +foreign import ccall safe "rts_pause_lock.h lockThenPause" + safe_lockThenPause_c :: Ptr CInt -> IO () + +main :: IO () +main = alloca $ \donePtr -> do + -- We don't expect a deadlock, but we want to avoid one in the case of a + -- failed test. + poke donePtr 0 + forkIO $ safe_assertDoneAfterOneSecond_c donePtr + + -- The actual test. + safe_lockThenPause_c donePtr |