-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple, IO-based library for Erlang-style thread supervision -- @package threads-supervisor @version 1.0.0.0 -- | Use threads-supervisor if you want the "poor-man's Erlang -- supervisors". threads-supervisor is an IO-based library with -- minimal dependencies which does only one thing: It provides you a -- Supervisor entity you can use to monitor your forked -- computations. If one of the managed threads dies, you can decide if -- and how to restart it. This gives you: -- -- -- -- You can install the threads-supervisor library by running: -- > $ cabal install threads-supervisor module Control.Concurrent.Supervisor.Tutorial module Control.Concurrent.Supervisor type Supervisor = Supervisor_ Initialised data DeadLetter data Child Child :: !RestartStrategy -> RestartAction -> Child type RestartAction = ThreadId -> IO ThreadId data SupervisionEvent ChildBorn :: !ThreadId -> !UTCTime -> SupervisionEvent ChildDied :: !ThreadId -> !SomeException -> !UTCTime -> SupervisionEvent ChildRestarted :: !ThreadId -> !ThreadId -> !RestartStrategy -> !UTCTime -> SupervisionEvent ChildFinished :: !ThreadId -> !UTCTime -> SupervisionEvent -- | Erlang inspired strategies. data RestartStrategy OneForOne :: RestartStrategy -- | Creates a new supervisor newSupervisor :: IO SupervisorSpec -- | Shutdown the given supervisor. This will cause the supervised children -- to be killed as well. shutdownSupervisor :: Supervisor -> IO () eventStream :: Supervisor -> TBQueue SupervisionEvent activeChildren :: Supervisor -> IO Int supervise :: SupervisorSpec -> IO Supervisor -- | Fork a thread in a supervised mode. forkSupervised :: Supervisor -> RestartStrategy -> IO () -> IO ThreadId instance Show RestartStrategy instance Show SupervisionEvent