myForkOS :: IO () -> IO (MVar ThreadId)
myForkOS io =
    do mvar <- newEmptyMVar
       forkIO (action `finally` (myThreadId >>= putMVar mvar))
       return mvar
    where action = do msg "started."
                      io

{- | Wait for child threads to die. 

This should only happen when there is nothing else to spider. -}
myForkOS :: IO () -> IO (MVar ThreadId)
myForkOS io =
    do mvar <- newEmptyMVar
       forkIO (action `finally` (myThreadId >>= putMVar mvar))
       return mvar
    where action = do msg "started."
                      io

{- | Wait for child threads to die. 

This should only happen when there is nothing else to spider. -}
myForkOS io =
    do mvar <- newEmptyMVar
       forkIO (action `finally` (myThreadId >>= putMVar mvar))
       return mvar
    where action = do msg "started."
                      io

{- | Wait for child threads to die. 

This should only happen when there is nothing else to spider. -}