summaryrefslogtreecommitdiff
path: root/testsuite/tests/rts/ffishutdown.hs
blob: e1688431c8c13d7512c92681e14fffdc3231fdd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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