async-manager-0.1.1.0: A thread manager for async

Safe HaskellNone
LanguageHaskell2010

Control.Concurrent.AsyncManager

Synopsis

Documentation

data AnyAsync Source

A existentially quantified wrapper for Async a

Constructors

forall a . AnyAsync (Async a) 

data AsyncManager Source

An Async thread manager. Keeps track of allocated and running Async threads. Useful for ensure threads are cleaned up

newAsyncManager :: IO AsyncManager Source

Create a new empty manager

newChildManager :: AsyncManager -> IO AsyncManager Source

Create a child manager

insert :: AsyncManager -> Async a -> IO () Source

Insert a new thread into the manager TODO: maybe I should check if the computation is still running

clear :: AsyncManager -> IO () Source

Cancel all threads and empty the manager

count :: AsyncManager -> IO Int Source

Thread count. Includes alive and dead threads

compact :: AsyncManager -> IO () Source

Remove references to dead threads

cancelWithManager :: AsyncManager -> Async a -> IO () Source

Cancel the thread and remove the entry from the manager

asyncWithManager :: AsyncManager -> IO a -> IO (Async a) Source

Create a new thread and add it to the manager