summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/ffishutdown.hs
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/tests/rts/ffishutdown.hs')
-rw-r--r--testsuite/tests/rts/ffishutdown.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/testsuite/tests/rts/ffishutdown.hs b/testsuite/tests/rts/ffishutdown.hs
new file mode 100644
index 0000000000..e1688431c8
--- /dev/null
+++ b/testsuite/tests/rts/ffishutdown.hs
@@ -0,0 +1,13 @@
+import Control.Concurrent
+import Control.Monad
+import Foreign.Ptr
+
+main = do
+ fptr <- wrap $ return . (*4)
+ forkIO $ forever $ do
+ _ <- dyn fptr 4
+ return ()
+ threadDelay $ 100 * 1000
+
+foreign import ccall "wrapper" wrap :: (Double -> IO Double) -> IO (FunPtr (Double -> IO Double))
+foreign import ccall "dynamic" dyn :: FunPtr (Double -> IO Double) -> Double -> IO Double