-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A thread manager for async -- @package async-manager @version 0.1.0.0 module Control.Concurrent.AsyncManager -- | A existentially quantified wrapper for Async a data AnyAsync AnyAsync :: (Async a) -> AnyAsync -- | An Async thread manager. Keeps track of allocated and running Async -- threads. Useful for ensure threads are cleaned up newtype AsyncManager AsyncManager :: MVar (HashMap ThreadId AnyAsync) -> AsyncManager unAsyncManager :: AsyncManager -> MVar (HashMap ThreadId AnyAsync) -- | Create a new empty manager newAsyncManager :: IO AsyncManager -- | Insert a new thread into the manager TODO: maybe I should check if the -- computation is still running insert :: AsyncManager -> Async a -> IO () -- | Cancel all threads and empty the manager clear :: AsyncManager -> IO () -- | Thread count. Includes alive and dead threads count :: AsyncManager -> IO Int -- | Remove references to dead threads compact :: AsyncManager -> IO () -- | Cancel the thread and remove the entry from the manager cancelWithManager :: AsyncManager -> Async a -> IO () -- | Create a new thread and add it to the manager asyncWithManager :: AsyncManager -> IO a -> IO (Async a) labelAsyncWithManager :: AsyncManager -> String -> IO a -> IO (Async a)