Skip to content
Snippets Groups Projects
Commit a9aaf3d3 authored by Simon Marlow's avatar Simon Marlow
Browse files

[project @ 1998-08-14 13:02:00 by simonm]

Add _ccall_GC_ test (callbacks and performGC).
parent 50a3ac89
No related branches found
No related tags found
No related merge requests found
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.5 1998/08/12 11:05:14 simonm Exp $
# $Id: Makefile,v 1.6 1998/08/14 13:02:00 simonm Exp $
TOP = ../..
include $(TOP)/mk/boilerplate.mk
......@@ -9,6 +9,7 @@ SRC_HC_OPTS += -dcore-lint
packedstring001_HC_OPTS = -syslib misc
exceptions001_HC_OPTS = -fglasgow-exts
stableptr002_HC_OPTS = -fglasgow-exts
stableptr001_RUNTEST_OPTS = +RTS -K4m
dynamic001_HC_OPTS = -syslib exts
......
module Main where
import PrelForeign
-- Testing callbacks: the initial haskell thread calls out to C with
-- the address of a Haskell callback. The C function runs the callback
-- (in a new thread) and returns.
-- The stable pointer operation 'performIO' does the job of calling
-- the callback for us.
-- for an extra stressful test, the callback also does an explicit GC
-- to make sure that the original thread saved away its state
-- properly.
main = do
io <- makeStablePtr hello
_ccall_GC_ performIO io
putStr "finished"
hello :: IO ()
hello = do
_ccall_GC_ performGC
putStr "hello world!\n"
hello world!
finished
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment