+-- | Like 'forkIO', but the child thread is passed a function that can
+-- be used to unmask asynchronous exceptions. This function is
+-- typically used in the following way
+--
+-- > ... mask_ $ forkIOWithUnmask $ \unmask ->
+-- > catch (unmask ...) handler
+--
+-- so that the exception handler in the child thread is established
+-- with asynchronous exceptions masked, meanwhile the main body of
+-- the child thread is executed in the unmasked state.
+--
+-- Note that the unmask function passed to the child thread should
+-- only be used in that thread; the behaviour is undefined if it is
+-- invoked in a different thread.
+--
+forkIOWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
+forkIOWithUnmask io = forkIO (io unsafeUnmask)
+