0 | module Evince.Parallel
 1 |
 2 | import System.Concurrency
 3 |
 4 | %foreign "scheme:blodwen-thread"
 5 | prim__fork : PrimIO () -> PrimIO ()
 6 |
 7 | %foreign "scheme:(lambda (ty act fb) (guard (x [#t (fb (vector 0))]) (act (vector 0))))"
 8 | prim__tryIO : PrimIO a -> PrimIO a -> PrimIO a
 9 |
10 | ||| Fork an IO action into a new thread (Chez Scheme only).
11 | export
12 | forkIO : IO () -> IO ()
13 | forkIO act = primIO $ prim__fork (toPrim act)
14 |
15 | ||| Run an IO action; if it throws a Scheme exception, run the fallback.
16 | export
17 | tryIO : IO a -> IO a -> IO a
18 | tryIO act fallback = primIO $ prim__tryIO (toPrim act) (toPrim fallback)
19 |