Control.Concurrent.Compat

base-compat-0.10.5: A compatibility layer for base

Safe Haskell | Trustworthy
Language | Haskell98

Control.Concurrent.Compat

Synopsis

- module Control.Concurrent
- forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
- forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId

# Documentation

module Control.Concurrent

forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId #

Fork a thread and call the supplied function when the thread is about to terminate, with an exception or a returned value. The function is called with asynchronous exceptions masked.

    forkFinally action and_then =
      mask $ \restore ->
        forkIO $ try (restore action) >>= and_then

This function is useful for informing the parent when a child terminates, for example.

Since: base-4.6.0.0

forkOSWithUnmask :: ((forall a. IO a -> IO a) -> IO ()) -> IO ThreadId #

Like `forkIOWithUnmask`, but the child thread is a bound thread, as with `forkOS`.