Michael Weber <[EMAIL PROTECTED]> wrote
[snip]
> forkChild :: IO () -> IO (MVar ())
> forkChild p = do
> mvar <- newEmptyMVar
> forkIO (p >> putMVar mvar ())
> return mvar
This does not of course synthesise a non-daemonic forkIO from a daemonic one, because
it requires the parent thread to wait for the MVar. I suppose that a possible
alternative
to having separate daemonic and non-daemonic forking would be to have an atexit-type
function:
atThreadExit :: IO () -> IO()
which forkChild could use to wait for the mvar. But I'm not sure I like this, unless
there are other likely uses for atThreadExit.